Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Datagrid Control (http://www.velocityreviews.com/forums/f60-asp-net-datagrid-control.html)
-   -   Using sqlDataAdapter to fill Dataset (http://www.velocityreviews.com/forums/t761563-using-sqldataadapter-to-fill-dataset.html)

Andy G 01-31-2005 07:48 PM

Using sqlDataAdapter to fill Dataset
 
I am setting my adapter to the below value and then filling the dataset and
binding the data grid to that after I set my dataset equal to the datagrid's
datasource. I manual bind the fields of the query to the datagrid. Can I
set my sqlDataAdapter like this. It's choking on B.QSTN fields but finds
the first three. I SQL statement below works fine in my query analyzer.

SELECT A.PRSN_ID, A.LOGIN_NAME, A.ANSWER, B.QSTN, C.DESCR FROM
tblCFSPH_CM_LOGIN A INNER JOIN tblCFSPH_CM_PRSN_ROLE_LINK D ON A.PRSN_ID =
D.PRSN_ID INNER JOIN tblCFSPH_CM_ROLE C ON D.ROLE_ID = C.ROLE_ID LEFT JOIN
tblCFSPH_SECRT_QSTN B ON A.QSTN_ID = B.QSTN_ID

Thanks!



Elton Wang 01-31-2005 10:12 PM

Using sqlDataAdapter to fill Dataset
 
Hi Andy,

If you only want to bind the first three fields in the
query to the datagrid, that's OK.

Set datagrid's AutoGenerateColumns to False

and set three BoundColumns in the datagrid like:

<Columns>
<asp:BoundColumn DataField="PRSN_ID" HeaderText="ID">
</asp:BoundColumn>
<asp:BoundColumn DataField="LOGIN_NAME"
HeaderText="Name">
</asp:BoundColumn>
<asp:BoundColumn DataField="ANSWER" HeaderText="Answer">
</asp:BoundColumn>
</Columns>

That will only bind three field in the datagrid.

Hope it helps,

Elton Wang
elton_wang@hotmail.com

>-----Original Message-----
>I am setting my adapter to the below value and then

filling the dataset and
>binding the data grid to that after I set my dataset

equal to the datagrid's
>datasource. I manual bind the fields of the query to the

datagrid. Can I
>set my sqlDataAdapter like this. It's choking on B.QSTN

fields but finds
>the first three. I SQL statement below works fine in my

query analyzer.
>
>SELECT A.PRSN_ID, A.LOGIN_NAME, A.ANSWER, B.QSTN, C.DESCR

FROM
>tblCFSPH_CM_LOGIN A INNER JOIN tblCFSPH_CM_PRSN_ROLE_LINK

D ON A.PRSN_ID =
>D.PRSN_ID INNER JOIN tblCFSPH_CM_ROLE C ON D.ROLE_ID =

C.ROLE_ID LEFT JOIN
>tblCFSPH_SECRT_QSTN B ON A.QSTN_ID = B.QSTN_ID
>
>Thanks!
>
>
>.
>



All times are GMT. The time now is 07:00 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.