Click to See Complete Forum and Search --> : How to connect to SQL Server


comicrage
April 29th, 2003, 06:47 PM
Hi,

I am learning how to connect to SQL Server 7 with C-Sharp. Do anyone offer some help how to do this (sample code, etc...).

Thanks,

Rage

hiremath vishal
May 3rd, 2003, 06:14 AM
here is a sample code....

string DBConn = "Data Source=(local);Initial
Catalog=ddos_db;Integrated Security=SSPI;Connection
Reset=true;";
SqlConnection Conn = new SqlConnection(DBConn);
SqlCommand Cmd = Conn.CreateCommand();
Cmd.CommandText = "INSERT INTO SUBINFO VALUES (" +
c_id.ToString() + ", " +
salary.ToString()+" )";
Conn.Open();
Cmd.ExecuteNonQuery();
Conn.Close();