Beginer问题....学习使用ADO.net 我正在尝试向数据库插入一个值,但我的语法有困难...尝试此代码:
Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim connstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Z:\CompanyData.mdb"
Using conn = New OleDbConnection(connstring)
conn.Open()
Dim CieName As String
CieName = txtCieName.Text
Dim sqlQry As String = "INSERT INTO Company (CompanyName) VALUES (@CieName)"
Using cmd As New OleDbCommand(sqlQry, conn)
cmd.Parameters.AddWithValue("@CieName", CieName)
cmd.ExecuteNonQuery()
End Using
End Using
End Sub
@CieName是否适用于Access数据库?