In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Today, I will talk to you about the operation of the SQL statement when VB.NET modifies data with multiple txtbox. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
When VB.NET modifies data with multiple txtbox, the operation of the SQL statement
1. The text of a Button1 is a query and a DataGridView1, click the code of the query button
Private Sub Button1_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strConn = "Data Source=192.168.1.110/orcl;User ID=test;Password=orcl"
Dim dbcmd As OracleCommand
Dim dt = New DataTable ("ds")
Dim dbConnection As OracleConnection
Try
DbConnection = New OracleConnection (strConn)
DbConnection.Open ()
Dbcmd = dbConnection.CreateCommand
Dbcmd.CommandText = "select * from student"
Dim da As OracleDataAdapter = New OracleDataAdapter (dbcmd)
Da.Fill (dt)
DataGridView1.DataSource = dt 'you can assign the value of dt directly to the DataGridview1 control at this time
Catch ex As Exception
MsgBox ("error querying database")
End Try
End Sub
two。 There are two TextBox1.TextBox2, text box and a button, Button2, button text for modification, click on the code
Private Sub Button2_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim username, password As String
Dim temp, temp3 As String
If Len (TextBox1.Text.Trim) 0 Then
Username = "sname=" + "'" + TextBox1.Text.Trim + "'" + ","
Else
Username = ""
End If
If Len (TextBox2.Text.Trim) 0 Then
Password = "spwd=" + "'" + TextBox2.Text.Trim + "'" + ","
Else
Password = ""
End If
If Len (username) 0 And Len (password) 0 Then
Temp = username + password
MsgBox (temp.Length)
Temp = Mid (temp, 1, temp.Length-3)
MsgBox ("temp" + temp)
MsgBox ("current" + DataGridView1.CurrentRow.Cells (1) .value)
Else
Temp = ""
End If
Dim strConn = "Data Source=192.168.1.110/orcl;User ID=test;Password=orcl"
Dim dbcmd As OracleCommand
Dim dbConnection As OracleConnection
'If username.Length = 0 And password = 0 Then
Try
DbConnection = New OracleConnection (strConn)
DbConnection.Open ()
Dbcmd = dbConnection.CreateCommand
Dim temp2 As String
Temp2 = "update student set" + temp + "where sname=" + "'" + DataGridView1.CurrentRow.Cells (1). Value + "'"
Dbcmd.CommandText = temp2
MsgBox (temp2)
'dbConnection.BeginTransaction ()
Dbcmd.ExecuteNonQuery () 'returns the number of changed row lines
Catch ex As Exception
MsgBox ("modify failed")
Exit Sub
End Try
'Else
'MsgBox ("Please fill in the parameters to be modified")
'End If
End Sub
After reading the above, do you have any further understanding of the operation of the SQL statement when VB.NET modifies data with multiple txtbox? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.