vb.net - Populating a DataGrid using a Parameterised SQL Server Stored Procedure -
i'm newb visual studio , vb , need little help.
i've created project in visual studio 2012 express with:
- a data connection sql server db
- within data set
- a data source/tableadaptor linked
- a stored procedure.
it seems difficult see data connections, data sets, data sources , table adaptors have been created , i'm confused why 1 , 2 aren't same thing.
the stored procedure accepts parameters , provides results based on parameters.
in preview - works fine.
now, i'm trying populate data grid data data source using supplied parameters when button pressed. i'm falling down. i've instantiated tableadaptor
private sub btnreport_click_1(sender object, e routedeventargs) handles btnreport.click dim tableadapter new jbdataset.p_utility_unlocked_tasksdatatable() me.mydatagrid.datasource = tableadapter.getdata("report", "1234") end sub
i think first line (dim) correctly instantiates tableadapter know second line incorrect. i've looked on , cannot find out need do.
what's compile-time type of tableadapter
? hover on in vs , check.
my guess it's datatable
:
dim tableadapter new jbdataset.p_utility_unlocked_tasksdatatable()
because object referencing called tasks datatable.
you use dataadapter like this:
dim querystring string = _ "select customerid, companyname dbo.customers" dim adapter sqldataadapter = new sqldataadapter(querystring, connection) dim customers dataset = new dataset adapter.fill(customers, "customers")
Comments
Post a Comment