Using sqlDataAdapter to fill Dataset

A

Andy G

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!
 
E

Elton Wang

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
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top