Who is connected to database - Sample Application C#

This is a sample application just to show who is currently connected into database MSSQL. The application actually just execute MSSQL command " sp_who " and show the data into datagrid. Below is a screen shoot of the sample application. Code Behind View Who Is Connected Form          public Form1()         {             InitializeComponent();         }         private void button2_Click(object sender, EventArgs e)         {             this.Close();         }         private void button1_Click(object sender, EventArgs e)         {             string ipaddress = textBox1.Text;             string username = textBox2.Text;             string password = textBox3.Text;             string dbNAme = textBox4.Text;             ViewUserActive form = new ViewUserActive();             form.popupInformation(ipaddress, username, password, dbNAme);                }         private void Form1_Load(object sender, EventArgs e)         {                  } Code Behind ViewUserActive Form      

Kentico 7 - Get Specific document information

This post will show how to get specific document information using Transformation In Kentico 7. Note : i have tested this method in kentico 7 only, donno if the other version will work. You can refer this link to create new transformation method Example : You can use this method in your transformation let say you create new repeater and want to show the parent name of the binding document type data. In this scenario, the document type store under different parent node.        public string getDocumentInfo(string documentID, string parentProperties)         {             TreeProvider tree = new CMS.DocumentEngine.TreeProvider(CMSContext.CurrentUser);             TreeNode Node = DocumentHelper.GetDocument(Convert.ToInt16(documentID), tree);             if (Node != null)             {                 switch (parentProperties)                 {                     case "NodeID": return Node.NodeID.ToString();                     case "NodeAliasPath": return Node.NodeAli

[SOLVED]Login failed for user ''. (Microsoft SQL Server, Error: 18456)

If you want to try to connect to database using sql authentication and the result is failed due to error code "18456" , here are the solution that you might want to try. I already solved the issue (in my case the problem because of the database did not set to allow sql connection to pass. So the solution is to enable the SQL Server authentication. Enable SQL Server Authentication  Login to the SQL Server using windows authentication. Right click on the SQL Server node >> properties. Go to Security tab. Under SQL Authentication choose SQL Server and Windows Authentication mode. Click Ok Button. Go to Services . Control Panel >> Administrative tools >> Services >> Find SQLServer instance. Restart SQL Server instance. Try to login again using your login information. Done. By Mohd Zulkamal NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

SQL view error "more column names specified than columns defined"

Error Executing Database Query. [Macromedia][SQLServer JDBC Driver][SQLServer]View or function 'dbo.myviewname' has more column names specified than columns defined. The error occur because of the original table has changed the column. So that the view definition will affected and whenever you perforl select statement the error will occur. Solution Resave the view table and the problem solve. By Mohd Zulkamal NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

C# - How to open form in full screen

This example shows how to make open windows form full screen of computer. In this example, i will use F11 as a shortcut key to turn form to full screen. Step By Step : Create one windows form project Add Form 2 in the solution. Add method to event Key Up in Form 1 Copy code below in Key Up  event method Form 1 The Code private bool _bFullScreenMode = false; : : : private void Form1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { if ( e.KeyData == Keys.F11) { if (_bFullScreenMode == false) { Form2 f = new Form2(); this.Owner = f; this.FormBorderStyle = FormBorderStyle.None; this.Left = (Screen.PrimaryScreen.Bounds.Width/2 - this.Width/2); this.Top = (Screen.PrimaryScreen.Bounds.Height/2 - this.Height/2); f.Show(); _bFullScreenMode = true; f.KeyUp +=new KeyEventHandler(Form1_KeyUp); } else { Form f = this.Owner; this.Owner = null; f.Close(); this.FormBorderStyle = FormBorderStyle.Sizable;

Moving text example in C#

This is a example of creating moving text in C#. In order to do the moving text, you just need timer and label controller/component . Steps by Step: Create one windows form project add one label in the form. copy and paste code below. Hit "CTRL + F5" and see what will happen. The code : public partial class Form1 : Form     {         private string[] words = new string[3];         private int i, j;         public Form1()         {             InitializeComponent();         }         private void timer1_Tick(object sender, EventArgs e)         {             if(i.Equals(words[j].Length))             {                               label1.Text = "";                 if (j < words.Length - 1)                 {                     j = j + 1;                     label1.Text = words[j];                 }                 else                 {                     j = 0;                 }                 i = 0;             }             label1.Text = words[j].Substring

CSV Splitter example in VB.NET

Hye guys, this is a example of CSV Splitter created from VB.NET language. Since i dont have enough time to explained each code, so i just copy the code here and feel free to ask me in the comment. Basically this example will split huge .csv file into several file. So that you can open the csv file faster rather than open the huge one. The Code Imports System.IO Imports System.Text Public Class Form1     Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code "     <STAThread()> _     Public Shared Sub Main()         Application.EnableVisualStyles()         Application.Run(New Form1)     End Sub     Public Sub New()         MyBase.New()         'This call is required by the Windows Form Designer.         InitializeComponent()         'Add any initialization after the InitializeComponent() call     End Sub     'Form overrides dispose to clean up the component list.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boole