--____LPHMXLZMXOMRLFKSEJCW____
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi I am trying to fill a datagrid using the following snippet:
GetSQL =3D "Select QID, Q, A, B, C, D, CorrectAnswer, Expired " & _
"From Questions " & _
"INNER JOIN " & _
"QuestionTypesList ON Questions.QTID =3D QuestionTypesList=
.QTID " & _
"WHERE (QuestionTypesList.QuestionTypes =3D '" & =
QsetSelected & "')"

rs.Close()
rs.Open(GetSQL, ConfigCN, ADODB.CursorTypeEnum.adOpenStatic, =
ADODB.LockTypeEnum.adLockOptimistic)
rs.MoveFirst()
Dim da As OleDbDataAdapter =3D New OleDbDataAdapter
Dim ds As DataSet =3D New DataSet
Try
da.Fill(ds, rs, "QTable")
Catch ex As Exception
MsgBox(ex)
End Try
DataGrid1.DataSource =3D ds.Tables(0)

But when I do I get a catch error when trying da.fill:
Argument 'Prompt' cannot be converted to type 'String'.

Any ideas/suggestions welcome!

Cheers
Adam

--____LPHMXLZMXOMRLFKSEJCW____
Content-Type: multipart/related; boundary="____WHPEPQYSAQXEHDGESJXG____"


--____WHPEPQYSAQXEHDGESJXG____
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Diso-8859-1"=
>
<META content=3D"MSHTML 6.00.2800.1476" name=3DGENERATOR></HEAD>
<BODY style=3D"MARGIN: 4px 4px 1px; FONT: 8pt Tahoma; COLOR: #000000">
<DIV>Hi I am trying to fill a datagrid using the following snippet:</DIV>
<DIV>GetSQL =3D "Select QID, Q, A, B, C, D, CorrectAnswer, Expired " &amp; =
_<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp; "From Questions " &amp; _<BR>&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p; "INNER JOIN " &amp; _<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "QuestionTypesList ON =
Questions.QTID =3D QuestionTypesList.QTID " &amp; _<BR>&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; "WHERE (QuestionTypesList.QuestionTypes =3D '" &amp; QsetSelected &amp; =
"')"</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rs.Close()<BR>&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rs.Open(GetSQL, ConfigCN, ADODB.CursorTypeEnu=
m.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)<BR>&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp; rs.MoveFirst()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp; Dim da As OleDbDataAdapter =3D New OleDbDataAdapter<BR>&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim ds As DataSet =3D New DataSet<BR>&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Try<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; da.Fill(ds, rs, "QTable")<BR>&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Catch ex As Exception<BR>&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox(ex)<BR>&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End Try<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp; DataGrid1.DataSource =3D ds.Tables(0)</DIV>
<DIV>&nbsp;</DIV>
<DIV>But when I do I get a catch error when trying da.fill:</DIV>
<DIV>Argument 'Prompt' cannot be converted to type 'String'.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Any ideas/suggestions welcome!</DIV>
<DIV>&nbsp;</DIV>
<DIV>Cheers</DIV>
<DIV>Adam</DIV></BODY></HTML>

--____WHPEPQYSAQXEHDGESJXG____--

--____LPHMXLZMXOMRLFKSEJCW____--

RE: Error filling datagrid by Aaron

Aaron
Fri Oct 22 11:55:06 CDT 2004

Adam,

Is the QsetSelected a object, like a select list or something. If so, what
is its default property? And what is it putting into your GetSql string.
Debug.write your GetSql string out and make sure that the WHERE clause looks
correct.

Aaron


"Adam Maltby" wrote:

> Hi I am trying to fill a datagrid using the following snippet:
> GetSQL = "Select QID, Q, A, B, C, D, CorrectAnswer, Expired " & _
> "From Questions " & _
> "INNER JOIN " & _
> "QuestionTypesList ON Questions.QTID = QuestionTypesList..QTID " & _
> "WHERE (QuestionTypesList.QuestionTypes = '" & QsetSelected & "')"
>
> rs.Close()
> rs.Open(GetSQL, ConfigCN, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic)
> rs.MoveFirst()
> Dim da As OleDbDataAdapter = New OleDbDataAdapter
> Dim ds As DataSet = New DataSet
> Try
> da.Fill(ds, rs, "QTable")
> Catch ex As Exception
> MsgBox(ex)
> End Try
> DataGrid1.DataSource = ds.Tables(0)
>
> But when I do I get a catch error when trying da.fill:
> Argument 'Prompt' cannot be converted to type 'String'.
>
> Any ideas/suggestions welcome!
>
> Cheers
> Adam
>

Re: Error filling datagrid by Earl

Earl
Sat Oct 23 00:21:49 CDT 2004

Use a simpler method of filling the datatable, without the recordset, maybe
something like this:

Dim GetSQL As String = "Select QID, Q, A, B, C, D, CorrectAnswer, Expired "
& _
"From Questions " & _
"INNER JOIN " & _
"QuestionTypesList ON Questions.QTID =
QuestionTypesList.QTID " & _
"WHERE (QuestionTypesList.QuestionTypes = '" & QsetSelected
& "')"
Dim strOle As New OleDb.OleDbConnection (ConfigCN)
Dim da As New OleDbDataAdapter(GetSQL, strOle)
Dim ds as New Dataset
strOle.Open()
da.Fill(ds, "Qtable")
strOle.Close()



Re: Error filling datagrid by Adam

Adam
Mon Oct 25 05:48:14 CDT 2004


--____LPHMXLZMXOMRLFKSEJCW____
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Earl,

Thanks for that, once I pasted in your code i did a SetDataBindings on the =
datagrid and it all fell into place!


Adam

--____LPHMXLZMXOMRLFKSEJCW____
Content-Type: multipart/related; boundary="____WHPEPQYSAQXEHDGESJXG____"


--____WHPEPQYSAQXEHDGESJXG____
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Diso-8859-1"=
>
<META content=3D"MSHTML 6.00.2800.1476" name=3DGENERATOR></HEAD>
<BODY style=3D"MARGIN: 4px 4px 1px; FONT: 8pt Tahoma; COLOR: #000000">
<DIV>Hi Earl,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks for that, once I pasted in your code i did a SetDataBindings =
on the datagrid and it all fell into place!</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Adam</DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

--____WHPEPQYSAQXEHDGESJXG____--

--____LPHMXLZMXOMRLFKSEJCW____--