hainansyndrome
asked on
varbinary in datagridview, from data set
I am binding a dataset to a datagridview
in it there is a varbinary field which dsplays as a picture
if the field is null not problem but if It is not null then it crashed the datagrid
I want to edit teh dataset before i bind it,
if it is NULL then i want to show ""
if it is not null i want to just show"Encrypted Password"
I am ne to dotnet so I am relatively clueless where to start
where is what I have this far
in it there is a varbinary field which dsplays as a picture
if the field is null not problem but if It is not null then it crashed the datagrid
I want to edit teh dataset before i bind it,
if it is NULL then i want to show ""
if it is not null i want to just show"Encrypted Password"
I am ne to dotnet so I am relatively clueless where to start
where is what I have this far
Dim da As SqlDataAdapter = New SqlDataAdapter("Select * from security whereofficerid='" & ComboBox1.SelectedValue.ToString() & "'" & _
" and pmrespersonid = '" & TextBox2.Text & "'", cn)
Dim DS As DataSet = New DataSet
da.Fill(DS)
DataGridView1.DataSource = DS.Tables(0)
DS.Dispose()
cn.Close()
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
yes i had thought about editing the query problem is i want to show every field in the table and did not want to have to write each field
CodeCruiser
can you give me an example of what you man to use that
i am not sure where to place it
before i write the dataset to a databridview?
CodeCruiser
can you give me an example of what you man to use that
i am not sure where to place it
before i write the dataset to a databridview?
ASKER
works like a champ
iif(isdbnull(field), "", "Encrypt Password")
Now you need to write this code in an event so that this code executes for each row.