sql server - Displaying data from a dataset vb.net -
i having issues returning data ms sql database.
the code returning 'system.data.datarowview' instead of results of query. code sub is:
public sub newquery(query string) dim sqlconn sqlconnection = new sqlconnection dim sqlcommand new sqlcommand sqlconn.connectionstring = "data source=.\testing;initial catalog=eurostyle;integrated security=sspi;" sqlcommand = new sqlcommand(query, sqlconn) try sqlconn.open() sqlda = new sqldataadapter(sqlcommand) sqldataset = new dataset sqlda.fill(sqldataset) sqlconn.close() listbox1.datacontext = sqldataset catch ex exception msgbox(ex.message) end try end sub i new wpf , i'm sure trivial.
any appreciated!
datagrid view more appropriate display results database.
try this:
public sub newquery(query string) dim sqlconn sqlconnection = new sqlconnection dim sqlcomm new sqlcommand dim dbdataset new datatable dim bsource new bindingsource dim sqlda new sqldataadapter sqlconn.connectionstring = "data source=.\testing;initial catalog=eurostyle;integrated security=sspi;" try sqlconn.open() sqlcomm = sqlconn.createcommand sqlcomm.commandtext = query sqlcomm = new sqlcommand(zapytanie, myconn) sqlda.selectcommand = sqlcomm sqlda.fill(dbdataset) bsource.datasource = dbdataset datagridview.datasource = bsource sqlda.update(dbdataset) sqlconn.close() catch ex sqlexception messagebox.show("query error: " & ex.message) end try
Comments
Post a Comment