标题:cmd.ExecuteNonQuery() 这个地方老是报错整么回事?
只看楼主
L483342650
Rank: 2
等 级:论坛游民
帖 子:11
专家分:10
注 册:2021-7-19
结帖率:100%
 问题点数:0 回复次数:2 
cmd.ExecuteNonQuery() 这个地方老是报错整么回事?
Imports System.Data.SqlClient
Public Class Form1
    Private Conne As SqlConnection = New SqlConnection("Data Source=SWPDM\SWPDM;Initial Catalog=master;Integrated Security=True")
    Private Sub adddate()
        Dim cmd As SqlCommand
        Dim cmdstring As String = ("insert CustomTemp(名称,规格,材料) value (" + CStr(TextBox1.Text) + ",'" + TextBox2.Text + ",'" + TextBox3.Text + ",")
        cmd = New SqlCommand(cmdstring, Conne)
        Conne.Open()
        cmd.ExecuteNonQuery()
        Conne.Close()


    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        adddate()


    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
    End Sub
End Class
搜索更多相关主题的帖子: Private Text cmd Sub End 
2021-07-19 16:04
apull
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:三体星系
等 级:版主
威 望:185
帖 子:1404
专家分:8479
注 册:2010-3-16
得分:0 
Dim cmdstring As String = ("insert into CustomTemp(名称,规格,材料) value ('" + CStr(TextBox1.Text) + "','" + TextBox2.Text + "','" + TextBox3.Text + "'")
2021-07-19 19:17
L483342650
Rank: 2
等 级:论坛游民
帖 子:11
专家分:10
注 册:2021-7-19
得分:0 
非常感谢!
2021-07-20 13:46



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-506276-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.105334 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved