向access 添加数据

'以上是引用


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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值