well really there is only 1 way of doing this. it also depends the type of authentication you are using to connect to the database.
SqlCommand theSQLCommand = new SqlCommand("INSERT STATEMENT HERE", new SqlConnection("ConnectionStringHere"));
theSQLCommand.Connection.Open();
theSQLCommand.ExecuteNonQuery();
theSQLCommand.Connection.Close();
www.connectionstrings.com would be one place you can obtain the connection strings for SQL Server, amoungst other applications.
small example of deleting data....
SqlCommand theSQLCommand = new SqlCommand("DELETE FROM [TableName] WHERE [field] = @p1", new SqlConnection("ConnectionStringHere"));
SqlParameter theParam = new SqlParameter("@p1", "valueHere");
theSQLCommand.Parameters.Add(theParam);
theSQLCommand.Connection.Open();
theSQLCommand.ExecuteNonQuery();
theSQLCommand.Connection.Close();
|