Home > Net >  Vb.net physical database update problem
Vb.net physical database update problem

Time:10-03

Dim olecn As New OleDb. OleDbConnection
Dim oleDA As New OleDb. OleDbDataAdapter
Dim olecomm As New OleDb. OleDbCommand
Dim oledS As New DataSet
Dim xxtable As New DataTable

Public Sub bindgridview ()
Olecn. The ConnectionString=CNN 'access connection address, "the Provider=Microsoft. ACE. The OLEDB. 12.0; Data Source=F: \ \ vs2015 drive F - access database engine \ technical process system. Accdb
"Olecomm.
=olecn 'Connection to establish ConnectionXxtable. The Clear ()
Olecomm.Com mandText="select * from login information where='" & amp; UsernameTextBox. Text & amp; "'" 'execute query
OleDA. SelectCommand set instruments for query command=olecomm '
Olecn. The Open () 'Open the database
OleDA. The Fill (oledS, "login information") 'set of instruments to Fill data
Xxtable=oledS. Tables (" login information ")
'Dim myrow As DataRow=xxtable. NewRow
Olecn. Close ()
DataGridView1. The DataSource=xxtable 'oledS. Tables (" login information ")' oledS. The Tables (" login information ") 'will be set on the instruments to the data table content display to display

DataGridView1. Rows (0). DataBoundItem (" password ")=NewPasswordtextbox. Text

'oleDA. Update (oledS) Tables (" login information "))
OleDA. Update (DataGridView1. The DataSource)
'xxtable. The Clear ()

End Sub
Datagridview data can change it, but as long as the refresh, and the original data, that is to say, the physical database didn't be modified, which greatly under the guidance of, and what is going on! Thank you very much! Urgent need!!!!!

CodePudding user response:

No update is successful, this will define commandbuilder, update the entire table, not by the update statement,

CodePudding user response:

When bindgridview call


Should be separate, first half to the table to write in formload behind written in cell change event updates

CodePudding user response:

Novice, intellect, VB.NET, to read a book today, fewer builder!
Vb.net fewer books especially about database better, to learn a lot of trouble!

CodePudding user response:

DataBind ()

CodePudding user response:

Recommend you use the command ExecuteNonquery ()

CodePudding user response:

I have given up on builder to update the database, there are always puzzling problems
Now with the UPDATE field updates, tail must take ID, so that you can
If bl="xg" Then
DataGridView1. CurrentRow. Cells. The Item (" agent "). The Value=https://bbs.csdn.net/topics/qjxm
Olecomm.Com mandText="set update parameters and contract work medium='" & amp; Txt_jz. Text & amp; "', relative humidity=" & amp; Txt_sd. Text _
& "', flow='" & amp; Txt_ll. Text & amp; "', inlet pressure=" & amp; Txt_jqyl. Text & amp; "', exhaust pressure=" & amp; Txt_pqyl. Text & amp; "', inlet temperature=" & amp; Txt_jqwd. Text _
& "', exhaust temperature=" & amp; Txt_pqwd. Text & amp; "', user='" & amp; Txt_yh. Text & amp; "', contract number=" & amp; Txt_hth. Text & amp; "', the version number=" & amp; Txt_bbh. Text _
& "' note='" & amp; Txt_bz. Text & amp; "', modify=" & amp; QJXM & amp; "' and modification date=" & amp; Dtp_jbrq. Value & amp; "' the where id=" & amp; Datagw_jd
Olecn. The Open ()
OleDA. SelectCommand=olecomm
Olecomm. ExecuteNonQuery ()
Olecn. Close ()
End the If

CodePudding user response:

1) olecomm.Com mandText="select * from parameters and contract where" & amp; ComboBox1. Text & amp; "='" & amp; Txt_cx. Text & amp; "'" 'execute query

2) olecomm.Com mandText="select * from parameters and contract where" & amp; ComboBox1. Text & amp; "Like '%" & amp; Txt_cx. Text & amp; "% '"' execute query



Has a problem now, the execution, 1) can be detected data to check with 2) sentence, can't find anything, why not guide, please under the guidance of the great god. Thank you!
  • Related