Created
January 21, 2014 12:22
-
-
Save arbaaz/8539042 to your computer and use it in GitHub Desktop.
Sql_connection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string connectionString = "Data Source=ARBAAZLPT\\SQLEXPRESS;Initial Catalog=bi;User ID=sa; Password=123456;"; | |
SqlConnection sqlConnection=new SqlConnection(connectionString); | |
string insertStatement = "INSERT INTO comment(dashboard,userid,tab,comment,date,timestamp,chartdesc) VALUES ('" + DashboardList.SelectedValue + "','" + userid_text.Text + "','" + chartList.SelectedValue + "','" + coment_txt.Text + "','" + dt+ "', GETDATE(),'"+ chart_desc.Text + "')"; | |
// string insertStatement = "INSERT INTO comment(dashboard,userid,tab,comment,date,chartdesc)VALUES ('mydashboard','myuserid','mytab','mycomment','02-20-1990','mychartdesc')"; | |
SqlCommand sqlCommand=new SqlCommand(insertStatement,sqlConnection); | |
try | |
{ | |
sqlConnection.Open(); | |
sqlCommand.ExecuteNonQuery(); | |
} | |
finally | |
{ | |
sqlConnection.Close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment