private void button1_Click(object sender, EventArgs e) { // SqlConnection connection = new SqlConnection(@"Server=Tambu-PC\SQLEXPRESS; initial catalog=BLOG; Integrated Security=True"); // connection.Open(); BlogDataSet dataSet = new BlogDataSet(); UserSetTableAdapter userAdapter = new UserSetTableAdapter(); userAdapter.Fill(dataSet.UserSet); userAdapter.Insert("Tom"); userAdapter.Update(dataSet); //SqlCommand command = // new SqlCommand(@"SELECT * FROM UserSet Where UserSet.UserName=@pname", connection); //SqlParameter param = new SqlParameter("@pname", "John"); //command.Parameters.Add(param); //SqlDataReader reader = command.ExecuteReader(); //while (reader.Read()) //{ // int id = reader.GetInt32(0); // string name = reader.GetString(1); //} //reader.Dispose(); // connection.Dispose(); }
static void Main(string[] args) { //var c = ConfigurationManager.AppSettings["PathToSourceFile"]; UserSetTableAdapter ad = new UserSetTableAdapter(); DataSet1 ds = new DataSet1(); ad.Fill(ds.UserSet); ds.UserSet.RemoveUserSetRow(ds.UserSet[0]); ad.Update(ds); }