'以上是引用
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextRlp.Text = "" Or TextXlp.Text = "" Or TextJyp.Text = "" Or TextChe.Text = "" Or TextPzj.Text = "" Or TextEr5.Text = "" Or TextRej.Text = "" Or TextAcc.Text = "" Or TextSts.Text = "" Or TextLot.Text = "" Then
MsgBox("请输入完整数值")
Return
End If
Dim cnstr = "provider=microsoft.ace.oledb.12.0;data source=D:\网站学习\VQA CSS模板样式\Access\VQA.accdb"
'定义连接字符串
Dim cn As OleDbConnection
cn = New OleDbConnection(cnstr)
'定义连接
cn.Open()
sqlstr = "INSERT INTO VQA(VQA_Month,rlp,xlp,jyp,che,pzjyp,ER5jyp,rejetlot,acc,sts,lots)values('" + DropDownList1.SelectedItem.Text + "','" + TextRlp.Text + "','" + TextXlp.Text + "','" + TextJyp.Text + "','" + TextChe.Text + "','" + TextPzj.Text + "','" + TextEr5.Text + "','" + TextRej.Text + "','" + TextAcc.Text + "','" + TextSts.Text + "','" + TextLot.Text + "');"
Dim cmd As New OleDbCommand(sqlstr, cn)
'以上是建立执行语句
Dim i As String
i = cmd.ExecuteNonQuery()
cn.Close()
If i > 0 Then
GridView1.DataBind()
End If
GridView1.DataBind()
‘关键是insert语句,
End Sub