Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27212

VS 2008 Save data to DB via OleDbDataAdapter and binding source, change value of one column

$
0
0
Hi!
I'm updateing my DB via an OleDbDataAdapter:
Code:

insertCommand = New OleDbCommand("INSERT INTO bundle (num,  document_id, .....) " & _
                                                    "VALUES (@num, @document_id, .... )", conn)
insertCommand.Parameters.Add("@num", OleDbType.Integer, 4, "num")
insertCommand.Parameters.Add( "@document_id", OleDbType.Integer, 4, "document_id")

Currently I have some DataGridViewComboBoxColumns with DataSource set to a DataTable read from database, with
Code:

myBindingSource.DataSource = "store_id"
With myComboBoxColumn
            .DataSource = alternativesDataTable 'filled from a separate table in the database
            .DataPropertyName = myBindingSource.DataSource()
            .DisplayMember = "title"
            .ValueMember = "id"
            .HeaderText = "MyColumn"
End With

How can I achieve something like this in pseudo code:
Code:

insertCommand.Parameters.Add("@sortiment", OleDbType.VarChar, 20, "store_id"->DisplayMember )
I cannot change the valueMember to be "title", as some titles contain percentage sign(%), which causes an error.

Viewing all articles
Browse latest Browse all 27212

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>