Ask a Question related to ASP Database, Design and Development.
-
Cast from type 'Field' to type 'String'
Hi,
Getting the above error - further info shown below
Line 36: II2 = 0
Line 37: response.write ("var questions" & II & " = new Array();" &
chr(10))
Line 38: oCmd.CommandText = "select distinct questions from whitepage
where topic ='" & oRs("topic") & "'"
Line 39: oRs2.open (oCmd, , 0, 1)
Line 40: if not(oRs2.BOF and oRs2.EOF) then
and
[InvalidCastException: Cast from type 'Field' to type 'String' is not
valid.]
Microsoft.VisualBasic.CompilerServices.StringType. FromObject(Object
Value) +616
Microsoft.VisualBasic.CompilerServices.ObjectType. StrCatObj(Object vLeft,
Object vRight) +138
ASP.questions_aspx.__Render__control1(HtmlTextWrit er __output, Control
parameterContainer) in d:\clients\4it4all.com\www\questions.aspx:38
System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +27
System.Web.UI.Control.Render(HtmlTextWriter writer) +7
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
System.Web.UI.Page.ProcessRequestMain() +1929
Using the code:-
oCmd.CommandText = "select distinct topic from whitepage where topic <> ''
and topic is not NULL"
oRs.open (oCmd, , 0, 1)
if not(oRs.BOF and oRs.EOF) then
while not oRs.EOF
II2 = 0
response.write ("var questions" & II & " = new Array();" & chr(10))
oCmd.CommandText = "select distinct questions from whitepage where topic
='" & oRs("topic") & "'"
oRs2.open (oCmd, , 0, 1)
if not(oRs2.BOF and oRs2.EOF) then
while not oRs2.EOF
response.write ("questions" & II & "[" & II2 & "] = """ &
replace(oRs2("questions"),chr(10),"") & """;" & chr(10))
oRs2.moveNext
II2 = II2 + 1
End While
end if
oRs2.close
II = II + 1
oRs.moveNext
End While
end if
oRs.close
Can anyone shed any light on this please
Cheers
Steve
Guest
-
how to type cast getjsobject form vb.net to c#
how to type cast getjsobject form vb.net to c# -
Object of type 'System.String' cannot be converted to type 'System
I'm trying to get a control from metabuilders.com dual list)to work under ASP.NET 2.0. It worked find under 1.1 and then when i migrated my... -
Problem with character palette and Tracking field: can't type zero after type is modified
System: Illustrator CS, Panther 10.3.3 Try this: Create a few characters of type. Select some letters and change their tracking (Option + Command... -
cast from datetime type to smalldatetime type?
Hi, How can I cast from datetime type to smalldatetime type. I get the records from a table which has got a datetime type column but I want to... -
Cast from type 'DBNull' to type 'String' is not valid error
Trying to add an insert button Sub btnAddRow_Click event for adding a row to the datagrid and dataset back to SQL. Had it working per the... -
Aaron Bertrand [MVP] #2
Re: Cast from type 'Field' to type 'String'
> Line 36: II2 = 0
First, you shouldn't be using nested recordsets; have you considered a join?> Line 37: response.write ("var questions" & II & " = new Array();" &
> chr(10))
> Line 38: oCmd.CommandText = "select distinct questions from whitepage
> where topic ='" & oRs("topic") & "'"
> Line 39: oRs2.open (oCmd, , 0, 1)
> Line 40: if not(oRs2.BOF and oRs2.EOF) then
Second, if you are using ASP.NET, please ask questions in an ASP.NET group,
e.g.
[url]news://msnews.microsoft.com/microsoft.public.dotnet.framework.aspnet[/url]
vLeft,> [InvalidCastException: Cast from type 'Field' to type 'String' is not
> valid.]
> Microsoft.VisualBasic.CompilerServices.StringType. FromObject(Object
> Value) +616
> Microsoft.VisualBasic.CompilerServices.ObjectType. StrCatObj(Object> Object vRight) +138
> ASP.questions_aspx.__Render__control1(HtmlTextWrit er __output, Control
> parameterContainer) in d:\clients\4it4all.com\www\questions.aspx:38
> System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +27
> System.Web.UI.Control.Render(HtmlTextWriter writer) +7
> System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
> System.Web.UI.Page.ProcessRequestMain() +1929
Aaron Bertrand [MVP] Guest
-
Mark Schupp #3
Re: Cast from type 'Field' to type 'String'
I think in .NET you have to fully qualify the value as in:
oRs2("questions").value
--
Mark Schupp
Head of Development
Integrity eLearning
[url]www.ielearning.com[/url]
<steve@i-db.com> wrote in message
news:7J5sb.6965$lm1.49079@wards.force9.net...vLeft,> Hi,
>
> Getting the above error - further info shown below
>
> Line 36: II2 = 0
> Line 37: response.write ("var questions" & II & " = new Array();" &
> chr(10))
> Line 38: oCmd.CommandText = "select distinct questions from whitepage
> where topic ='" & oRs("topic") & "'"
> Line 39: oRs2.open (oCmd, , 0, 1)
> Line 40: if not(oRs2.BOF and oRs2.EOF) then
>
> and
>
> [InvalidCastException: Cast from type 'Field' to type 'String' is not
> valid.]
> Microsoft.VisualBasic.CompilerServices.StringType. FromObject(Object
> Value) +616
> Microsoft.VisualBasic.CompilerServices.ObjectType. StrCatObj(Object> Object vRight) +138
> ASP.questions_aspx.__Render__control1(HtmlTextWrit er __output, Control
> parameterContainer) in d:\clients\4it4all.com\www\questions.aspx:38
> System.Web.UI.Control.RenderChildren(HtmlTextWrite r writer) +27
> System.Web.UI.Control.Render(HtmlTextWriter writer) +7
> System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
> System.Web.UI.Page.ProcessRequestMain() +1929
>
> Using the code:-
>
> oCmd.CommandText = "select distinct topic from whitepage where topic <> ''
> and topic is not NULL"
> oRs.open (oCmd, , 0, 1)
> if not(oRs.BOF and oRs.EOF) then
> while not oRs.EOF
> II2 = 0
> response.write ("var questions" & II & " = new Array();" & chr(10))
> oCmd.CommandText = "select distinct questions from whitepage where topic
> ='" & oRs("topic") & "'"
> oRs2.open (oCmd, , 0, 1)
> if not(oRs2.BOF and oRs2.EOF) then
> while not oRs2.EOF
> response.write ("questions" & II & "[" & II2 & "] = """ &
> replace(oRs2("questions"),chr(10),"") & """;" & chr(10))
> oRs2.moveNext
> II2 = II2 + 1
> End While
> end if
> oRs2.close
> II = II + 1
> oRs.moveNext
> End While
> end if
> oRs.close
>
> Can anyone shed any light on this please
>
> Cheers
>
> Steve
>
>
Mark Schupp Guest



Reply With Quote

