 |
|
ช่วยดูโคดให้หน่อยครับใช้คำสั่่ง ExecuteSQL ไม่ได้ครับ งง มาก |
|
 |
|
|
 |
 |
|
Code (VB.NET)
ExecuteSQL("INSERT INTO Customer (,Cus_no,c_name,c_lname,gender,address,number,phon)VALUES ('" & c_id.Text & "','" & c_name.Text & "','" & c_lname.Text & "','" & gender.Text & "','" & address.Text & "','" & number.Text & "','" & phone.Text & "','')")
'ExecuteSQL("SELECT * FROM Table1")
MessageBox.Show("เรียบร้อยแล้ว", "OK")
เพื่อนผมส่งมาให้ โปรแกรมของมันก็รันบนเครื่องผมและบันทึกข้อมูลได้ แต่ของผม มันติดคำสั่ง ExecuteSQL แต่ของเพื่อนผมไม่เป็นอะไร งง มากครับ ผู้รู้ช่วยอธิบายหน่อยครับ
Tag : .NET, Ms Access
|
|
 |
 |
 |
 |
Date :
2012-01-16 19:33:45 |
By :
อั๋น |
View :
1440 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มันจะไม่ติดได้ไงครับ มันผิด
INSERT INTO Customer (,
|
 |
 |
 |
 |
Date :
2012-01-16 20:11:17 |
By :
ikikkok |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองเอาออกแล้วครับ มันก็เหมือนเดิมอะ
Error 1 'ExecuteSQL' is not declared. It may be inaccessible due to its protection level.
มันคืออะไรพอจะบอกได้ป่าวครับ
|
 |
 |
 |
 |
Date :
2012-01-16 20:52:54 |
By :
อั๋น |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใน .NET มี ExecuteSQL ด้วยเหรอครับ
Code (VB.NET)
Dim myConnection As SqlCeConnection
'myConnection = New SqlCeConnection("Data Source =" + (System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase ) + "\Database1.sdf;"))
myConnection = New SqlCeConnection("Data Source=C:\WindowsFormsApplication\WindowsFormsApplication\Database1.sdf;")
myConnection.Open()
Dim myCommand As SqlCeCommand = myConnection.CreateCommand()
myCommand.CommandText = "INSERT INTO [mytable] ([name], [email]) VALUES " & _
" ('" & Me.txtName.Text & "','" & Me.txtEmail.Text & "' ) "
myCommand.CommandType = CommandType.Text
myCommand.ExecuteNonQuery()
myConnection.Close()
MessageBox.Show("Save Successfully.")
Go to : .NET Windows Form Application เขียนโปรแกรมบน Windows Form Application ด้วย .NET Framework
|
 |
 |
 |
 |
Date :
2012-01-16 21:11:47 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|