public partial class Page1 : Page { public Page1() { InitializeComponent(); } private void buttonUpdate_Click(object sender, RoutedEventArgs e) { SqlConnection conn = new SqlConnection(); string connString = "server=gladiator\\sqlexpress; database=MoviesStorage; Integrated Security=SSPI; "; conn.ConnectionString = connString; conn.Open(); string commString = "SELECT * FROM Customer_Info"; SqlCommand comm = new SqlCommand(commString, conn); SqlDataAdapter dtAdapter = new SqlDataAdapter(comm); SqlCommandBuilder commBuilder = new SqlCommandBuilder(dtAdapter); DataSet dtSet = new DataSet(); dtAdapter.Fill(dtSet, "Customer_Info"); DataRow dtRow = dtSet.Tables["Customer_Info"].NewRow(); dtRow["myID"] = textID.Text; dtRow["myName"] = textName.Text; dtRow["myIC"] = textIC.Text; dtRow["myContact"] = textContact.Text; dtSet.Tables["Customer_Info"].Rows.Add(dtRow); dtAdapter.Update(dtSet, "Customer_Info"); conn.Close(); } }
string connString = "server=gladiator\\sqlexpress; database=MoviesStorage; Integrated Security=True;"; //Or //string connString = "server=gladiator\\sqlexpress; database=MoviesStorage;uid=" + username + ";pwd=" + password + ";";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)