public string Insert(InsertUser user) { string msg; con.Open(); SqlCommand cmd = new SqlCommand("insert into dbo.UserTab (Name, Email) values(@Name, @Email)", con); cmd.Parameters.AddWithValue("@Name", user.Name); cmd.Parameters.AddWithValue("@Email", user.Email); int g = cmd.ExecuteNonQuery(); if (g == 1) { msg = "Successfully Inserted"; } else { msg = "Failed to Insert"; } return(msg); }
public string Insert(InsertUser user) { string msg; SqlConnection con = new SqlConnection("Data Source=desktop-gb128hp\\mssql2014; Initial Catalog=MyTestDB;Persist Security Info = True; User ID = sa; Password = FErdy277; Pooling = false;"); con.Open(); SqlCommand cmd = new SqlCommand("Insert into UserTab (Name, Email) values (@Name, @Email)", con); cmd.Parameters.AddWithValue("@Name", user.Name); cmd.Parameters.AddWithValue("@Email", user.Email); int g = cmd.ExecuteNonQuery(); if (g == 1) { msg = "Successfully Inserted"; } else { msg = "Failed to insert"; } return(msg); }
public string Insert(InsertUser user) { string msg; SqlConnection con = new SqlConnection("Data Source=TEPOS;Initial Catalog=TestDB;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"); con.Open(); SqlCommand cmd = new SqlCommand("Insert into UserTab(Name, Email) values (@Name, @Email)", con); cmd.Parameters.AddWithValue("@Name", user.Name); cmd.Parameters.AddWithValue("@Email", user.Email); int g = cmd.ExecuteNonQuery(); if (g == 1) { msg = "Berhasil Tambah data"; } else { msg = "Gagal tambah data"; } return(msg); }
public string Insert(InsertUser user) { string msg; SqlConnection con = new SqlConnection("Data Source=DESKTOP-0QLRLVG;Initial Catalog=CrudDB;Persist Security Info=True;User ID=sa; Password=albana123"); con.Open(); SqlCommand cmd = new SqlCommand("Insert into dbo.UserTab (Name, Email) values(@Name, @Email)", con); cmd.Parameters.AddWithValue("@Name", user.Name); cmd.Parameters.AddWithValue("@Email", user.Email); int g = cmd.ExecuteNonQuery(); if (g == 1) { msg = "Successfuly Inserted"; } else { msg = "Failed to Insert"; } return(msg); }
public string Insert(InsertUser user) { string msg; SqlConnection con = new SqlConnection("Data Source=DESKTOP-CM1O7BQ;Initial Catalog=MyTestDB;User ID=sa;Password=123"); con.Open(); SqlCommand cmd = new SqlCommand("Insert into UserTab (Name, Email) values(@Name, @Email)", con); cmd.Parameters.AddWithValue("@Name", user.Name); cmd.Parameters.AddWithValue("@Email", user.Email); int g = cmd.ExecuteNonQuery(); if (g == 1) { msg = "Successfully Inserted"; } else { msg = "Failed to Insert "; } return(msg); }
public string Insert(InsertUser user) { string msg; SqlConnection con = new SqlConnection("Data Source=DESKTOP-4ON24VD\\MUAMMARSQL;Initial Catalog=pat_wcf;Persist Security Info=True;User ID=sa; Password=muammar310"); con.Open(); SqlCommand cmd = new SqlCommand("Insert into UserTab (Name, Email) values(@Name, @Email)", con); cmd.Parameters.AddWithValue("@Name", user.Name); cmd.Parameters.AddWithValue("@Email", user.Email); int g = cmd.ExecuteNonQuery(); if (g == 1) { msg = "Successfully Inserted"; } else { msg = "Failed to Insert"; } return(msg); }
public string Insert(InsertUser user) { string msg; SqlConnection con = new SqlConnection("Data Source=DESKTOP-3M69Q4U;Initial catalog=MyTestDB;Persist Security info=True;User ID=sa;Password=Pbun2018;Pooling=False"); con.Open(); SqlCommand cmd = new SqlCommand("insert into USerTab (Name, Email) values (@Name, @Email)", con); cmd.Parameters.AddWithValue("@Name", user.Name); cmd.Parameters.AddWithValue("@Email", user.Email); int g = cmd.ExecuteNonQuery(); if (g == 1) { msg = "Successfully Inserted"; } else { msg = "Failed into Insert"; } return(msg); }
public string Insert(InsertUser user) { string msg; SqlConnection con = new SqlConnection("Data Source=LAPTOP-02VA70I5;Initial Catalog=premier-svr.MyTestDB;Persist Security Info=True;User ID=sa;Password=18042001bandung;Pooling=False"); con.Open(); SqlCommand cmd = new SqlCommand("Insert into UserTab (Name, Email) values(@Name, @Email)", con); cmd.Parameters.AddWithValue("@Name", user.Name); cmd.Parameters.AddWithValue("@Email", user.Email); int g = cmd.ExecuteNonQuery(); if (g == 1) { msg = "Successfully Inserted"; } else { msg = "Failed to insert"; } return(msg); }
public string Insert(InsertUser user) { string msg; SqlConnection con = new SqlConnection("Data Source=DESKTOP-LDV7NOV;Initial Catalog=WCFService1;Integrated Security=True"); con.Open(); SqlCommand cmd = new SqlCommand("Insert into UserTab (Name, Email) values(@Name, @Email)", con); cmd.Parameters.AddWithValue("@Name", user.Name); cmd.Parameters.AddWithValue("@Email", user.Email); int result = cmd.ExecuteNonQuery(); if (result == 1) { msg = "Sukses"; } else { msg = "Gagal"; } return(msg); }
public string Insert(InsertUser user) { string Message; SqlConnection con = new SqlConnection("Data Source=laptop-hgh9ccba;Initial Catalog=MyTestDB;Persist Security Info=True;User ID=sa;Password=311000;Pooling=False"); con.Open(); SqlCommand cmd = new SqlCommand("Insert into UserTab (Name, Email) values(@Name, @Email)", con); cmd.Parameters.AddWithValue("@Name", user.Name); cmd.Parameters.AddWithValue("@Email", user.Email); int result = cmd.ExecuteNonQuery(); if (result == 1) { Message = "Succesfully Inserted"; } else { Message = "Failed to Insert"; } con.Close(); return(Message); }