Dataset VS Datagrid
-
I have the following code: sqlDataAdapter2.SelectCommand.Parameters["@Id"].Value = intId; sqlDataAdapter2.SelectCommand.Parameters["@Bdate"].Value = dtpFrom.Value; sqlDataAdapter2.SelectCommand.Parameters["@Edate"].Value = dtpTo.Value; int intRows = sqlDataAdapter2.Fill(dataTime1,"Timesheet"); dgTime.Update(); The fill method is returning the right amount of rows (double check wwith a query) dgTime's datasource property is dataTime1.schema. But the datagrid never get's populated? Any ideas? Anymore info you may need to help me? Thanx in advance!
Jude
-
I have the following code: sqlDataAdapter2.SelectCommand.Parameters["@Id"].Value = intId; sqlDataAdapter2.SelectCommand.Parameters["@Bdate"].Value = dtpFrom.Value; sqlDataAdapter2.SelectCommand.Parameters["@Edate"].Value = dtpTo.Value; int intRows = sqlDataAdapter2.Fill(dataTime1,"Timesheet"); dgTime.Update(); The fill method is returning the right amount of rows (double check wwith a query) dgTime's datasource property is dataTime1.schema. But the datagrid never get's populated? Any ideas? Anymore info you may need to help me? Thanx in advance!
Jude
Did you bind the datagrid. Update is, if I remember, to put changes made in the data grid back into the database.
Upcoming Scottish Developers events: * UK Security Evangelists On Tour (2nd November, Edinburgh) * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog
-
Did you bind the datagrid. Update is, if I remember, to put changes made in the data grid back into the database.
Upcoming Scottish Developers events: * UK Security Evangelists On Tour (2nd November, Edinburgh) * Developer Day Scotland: are you interested in speaking or attending? My: Website | Blog
Desktop App, not web...No databind() for this object
Jude
-
Desktop App, not web...No databind() for this object
Jude
You still need to bind the datagridview to the data you wish to display. Check out these articles: http://msdn2.microsoft.com/en-US/library/071hftc7.aspx[^] http://msdn2.microsoft.com/en-US/library/wwh8ka92.aspx[^] Hope this helps.
-
You still need to bind the datagridview to the data you wish to display. Check out these articles: http://msdn2.microsoft.com/en-US/library/071hftc7.aspx[^] http://msdn2.microsoft.com/en-US/library/wwh8ka92.aspx[^] Hope this helps.
OK - check this out. I just ran a simple test to comfirm something. Here is what I did step by step. 1) Create new project(Windows Application). 2) Dragged a sqlDataAdapter onto the form. 3) Went through the wizard (create new connection, use sql statements, query builder, chose table, chose all columns. 4) Generate Dataset. 5) Dragged DataGrid onto form. 6) Set the Datasource property of the datagrid to the dataset.table 7) Added sqlDataAdapter.Fill to the load method of the form. Worked fine. I am doing the same with the project in question. The only difference is in the SELECT Statement. I am joining two tables into the data set and it is a stored procedure.
Jude