Posted on: 12/10/2013 5:17:35 AM | Views : 787

Hi all,

I am biggner in .NET. 
I am trying to create a windows application where i am trying to run some queires on SQL.
Here my code is -
--------------------------CODE START------------------------------------
String ConnectionString = "Server=" + ServerName.Text + ";Database=" + DatabaseName.Text + ";Integrated Security=SSPI;"; SqlConnection con = new SqlConnection(ConnectionString); SqlCommand cmd = new SqlCommand(); Object returnValue; string str = Domain.Text + "\\" + UserName.Text; cmd.CommandText = "SELECT Top (1) sid FROM sys.syslogins WHERE name = " + str; cmd.CommandType = CommandType.Text;
cmd.Connection = con;
con.Open(); returnValue = cmd.ExecuteScalar();

--------------------------CODE ENDS------------------------------------
When i am trying to execu ...

Go to the complete details ...