using System;
using System.Data;
using System.Data.SqlClient;
public class InsertingDataUsingSQLStatementsExecuteScalar
{
static void Main(string[] args)
{
string CN=
"Data Source=(local); Initial Catalog = DBNAME; Integrated Security=true
;
SqlConnection objConnection = new SqlConnection(CN);
String Query ="INSERT INTO tblTest(ID, Contact, Email) VALUES(3, 'Bill', 'John')";
SqlCommand objCmd = new SqlCommand(Query, onConnection);
objConnection.Open();
objCmd.ExecuteScalar();
objConnection.Close();
}
}
No comments:
Post a Comment