vb.net更新数据库 我是新手 句子中 cmd.CommandText = "insert into lquery。。。可以更新吗?在线等
ImportsSystem.DataImportsSystem.Data.SqlClientPublicClassForm3DimstrAsString="server=...
Imports System.Data
Imports System.Data.SqlClient
Public Class Form3
Dim str As String = "server=(local);Initial Catalog=test;Integrated security =SSPI;"
Dim conn As New SqlConnection(str)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
conn.Open()
Dim cmd As SqlCommand = conn.CreateCommand
cmd.CommandText = "insert into lquery(zhanghao ,mima ) values('str2','str3')"
conn.Close()
Me.Hide()
Form2.Show()
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim str2 As String = TextBox1.Text
Dim str3 As String = TextBox2.Text
End Sub
End Class 展开
Imports System.Data.SqlClient
Public Class Form3
Dim str As String = "server=(local);Initial Catalog=test;Integrated security =SSPI;"
Dim conn As New SqlConnection(str)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
conn.Open()
Dim cmd As SqlCommand = conn.CreateCommand
cmd.CommandText = "insert into lquery(zhanghao ,mima ) values('str2','str3')"
conn.Close()
Me.Hide()
Form2.Show()
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim str2 As String = TextBox1.Text
Dim str3 As String = TextBox2.Text
End Sub
End Class 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询