Cast problem

  • Thread starter Thread starter djamila
  • Start date Start date
D

djamila

Hi,

I wrote a program in ASP.net with IIS 5.1 using VB programming
language. When I transferred a site in a server which uses IIS 6, I had
some mistakes. One mistake is in that instruction:

v_xml = v_xml + "<id>" + CStr(reader1.GetSql32(0)) +"</id>"

This instruction works well in IIS 5.1 but In IIS 6 gives an error of
cast.
I tried a lot of other functions than CStr but I had every time the
same problem.

Thanks for your answers,

Regards,

Djamila.
 
using VB programming language

I assume you mean VB.NET, not VB...
v_xml = v_xml + "<id>" + CStr(reader1.GetSql32(0)) +"</id>"

Again, I assume you're using SQL Server, and that reader1 is a SqlDataReader
object...

If so, the SqlDataReader object doesn't have a GetSql32 method - it has a
GetSqlInt32 method, though, so I'm further assuming that that's what you
meant, and that the above is a typo...

http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.getsqlint32.aspx
This instruction works well in IIS 5.1 but In IIS 6 gives an error of
cast.

1) What is the complete error message?

2) What is the value of reader1(0) before you try to cast it?

3) Has the underlying database schema changed?

4) Is the IIS6 site pointing at the same database as the IIS 5.1 site...?
 
Back
Top