C
C#4mo ago
nunumars

✅ cant connect the data

i cant connect the data to this form helpp
No description
No description
21 Replies
Lalan
Lalan4mo ago
what's your code?
nunumars
nunumars4mo ago
here private void btnsave_Click(object sender, EventArgs e) { try { if (MessageBox.Show("Are You Sure You Want To Save This User?", "saving record", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.OK) {
cm = new SqlCommand("INSERT INTO Tableuser(Username,Fullname,Password,PhoneNo.)VALUES(@Username,@Fullname,@Password,@PhoneNo.)", con); cm.Parameters.AddWithValue("@Username", txtuser.Text); cm.Parameters.AddWithValue("@Fullname", txtfullname.Text); cm.Parameters.AddWithValue("@Password", txtpass.Text); cm.Parameters.AddWithValue("@Phone No.", txtphone.Text); con.Open(); cm.ExecuteNonQuery(); con.Close(); MessageBox.Show("User has been successfully saved."); Clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } ..................................... this one's my connector
nunumars
nunumars4mo ago
No description
SG97
SG974mo ago
assuming that tablename is correct, what's the error?
nunumars
nunumars4mo ago
the table name is correct
No description
nunumars
nunumars4mo ago
and i dont know the error T_T
SG97
SG974mo ago
so there is no exception?
nunumars
nunumars4mo ago
it doesnt have any popup after i enter it its just nothing
SG97
SG974mo ago
does it get run? put a breakpoint on the btnsave_Click
nunumars
nunumars4mo ago
whats breakpoint?
SG97
SG974mo ago
$debug
MODiX
MODiX4mo ago
Tutorial: Debug C# code and inspect data - Visual Studio (Windows)
Learn features of the Visual Studio debugger and how to start the debugger, step through code, and inspect data in a C# application.
SG97
SG974mo ago
debugging is the best tool you'll ever have
nunumars
nunumars4mo ago
ohh alrr thankss
SG97
SG974mo ago
F9 is the shortcut for breakpoint
nunumars
nunumars4mo ago
still cant find it T-T
SG97
SG974mo ago
place breakpoint, start debugging (F5), does the breakpoint get hit when you press the save button?
nunumars
nunumars4mo ago
i found it i read this i got lazy earlier but now i read it T-T DAAAANG THANKKK UUUU
SG97
SG974mo ago
perfect
sibber
sibber4mo ago
$close
MODiX
MODiX4mo ago
Use the /close command to mark a forum thread as answered