Tag : .NET, VBScript, Win (Windows App), VB.NET, VS 2010 (.NET 4.x), Windows
Date :
2013-09-24 09:11:48
By :
kwanckp
View :
2410
Reply :
4
No. 1
Guest
Code (VB.NET)
Public Sub savename(ByRef sqlstatement As String)
Dim cmd As MySqlCommand = New MySqlCommand
With cmd
.CommandText = sqlstatement
.CommandType = CommandType.Text
.Connection = SQLConnection
.ExecuteNonQuery()
End With
MessageBox.Show("เพิ่มข้อมูลเรียบร้อยแล้วค่ะ", "as", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sqlstatement As String = "insert into tb_user(user_name,password,fname,lname)values('" & TextBox1.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "')"
savename(sqlstatement)
Me.Hide()
End Sub