|
|
|
[VB.Net] Insert ข้อมูลไม่ได้ SQL SERVER 2008 |
|
|
|
|
|
|
|
Code
Dim objConn As New SqlConnection
Dim objCmd As SqlCommand
Dim strConnString, strSQL As String
strConnString = "Server=localhost;UID=sa;PASSWORD=xxx;Database=xxx;Max Pool Size=400;Connect Timeout=600;"
objConn.ConnectionString = strConnString
objConn.Open()
strSQL = "INSERT INTO tb_employee(emp_id, emp_title, emp_fname, emp_lname, emp_nickname, emp_email, emp_bdate, emp_address, emp_department, emp_active)"
strSQL += "VALUES('" + empID + "', '" + RdoTitle + "' , '" + txtFname.Text + "' , '" + txtLname.Text + "' , '" + txtNickname.Text + "'"
strSQL += " , '" + txtEmail.Text + "' , '" + dtpBdate.Text + "' , '" + txtAddress.Text + "' , '" + CbxDepart + "' , '1')"
MessageBox.Show(strSQL)
objCmd = New SqlCommand(strSQL, objConn)
objCmd.ExecuteNonQuery()
เวลากด Save มันจะฟ้อง error ที่บรรทัด objCmd.ExecuteNonQuery()
Tag : .NET, Ms SQL Server 2008, VB.NET
|
|
|
|
|
|
Date :
2014-11-19 11:20:35 |
By :
tatalas |
View :
847 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Err ว่ากระไรท่าน
|
|
|
|
|
Date :
2014-11-19 11:31:44 |
By :
lamaka.tor |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้ละครับ รูปแบบวันที่ผิดครับ ><
|
|
|
|
|
Date :
2014-11-19 11:58:44 |
By :
tatalas |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|