473,846 Members | 1,911 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Anybody help me on this: System.InvalidC astException

Hi,

Anybody help me regarding this error:

I am assigning the values to the session variables when the button is
clicked and passing these session variables to the next page and when I am
printing these session variables they are printing. After that I am
assigning these things in hidden object and in the form submit action I am
receiving these hidden values like the following:

dim Recname = Request("Recnam e")
dim Contactname = Request("Contac tname")
dim CompAddress = Request("Compad dress")
dim city = Request("City")
dim ZipCode = Request("Zipcod e")
dim Country = Request("Countr y")
dim TelePhone = Request("Teleph one")
dim Mobile = Request("Mobile ")
dim Email = Request("Emaili d")
dim Companysite = Request("Compan ysite")
dim Sector = Request("Sector ")
dim Functional = Request("Functi onal")
dim Yroperation = Request("Yroper ation")
dim Officeloc = Request("Office loc")
dim Usesite = Request("Usesit e")
dim Billaddress = Request("Billad dress")
dim Billcity = Request("Billci ty")
dim Billzip = Request("Billzi p")
dim Billctr = Request("Billco untry")
dim Resumeflag = Request("Resume flag")
dim Resumeemail = Request("Resume email")
dim Resumereg = "NO"
dim Recapprove = "YES"
Here also I succeeded when I am printing these declared variables with
assigned values. But when I am trying to insert these vales into the table
created in MS-Access like the following it is producing the given error:

sSQL = "INSERT INTO RECRUITERS
(Recname,Contna me,Recaddress,R eccity,ReczipCo de,Reccountry,R ecTelephone,Rec mobile,Recemail ,Recsite,Recsec tor,Recfunction al,Recyroper,Re cusesite,Recbil laddress,Recbil lcity,Recbillzi p,Recbillcountr y,Recresumeflag ,Recresumemail, Regdate,Recoffi celocations,Rec approve,Recappr overes)
values
(@Rname,@Contna me,@Raddress,@R city,@Rzip,@Rco untry,@Rphone,@ Rmobile,@Remail ,@Rsite,@Rsecto r,@Rfunction,@R year,@Rusite,@R billadd,@Rbillc ty,@Rbillzip,@R billctr,@Rflag, @RRemail,@RRegd ate,@Roffice,@R approve,@RRappr ove)"

oComm = New OleDbCommand(sS QL, oConn)
oComm.Commandty pe = CommandType.Tex t

oComm.Parameter s.Add(New OleDbParameter( "@Rname", UCASE(Recname)) )
oComm.Parameter s.Add(New OleDbParameter( "@Contname" , UCASE(Contactna me)))
oComm.Parameter s.Add(New OleDbParameter( "@Raddress" , UCASE(Compaddre ss)))
oComm.Parameter s.Add(New OleDbParameter( "@RCity", UCASE(City)))
oComm.Parameter s.Add(New OleDbParameter( "@Rzip", Zipcode))
oComm.Parameter s.Add(New OleDbParameter( "@Rcountry" , UCASE(Country)) )
oComm.Parameter s.Add(New OleDbParameter( "@Rphone", UCASE(Telephone )))
oComm.Parameter s.Add(New OleDbParameter( "@Rmobile", UCASE(Mobile)))
oComm.Parameter s.Add(New OleDbParameter( "@Remail", UCASE(Email)))
oComm.Parameter s.Add(New OleDbParameter( "@Rsite", UCASE(Companysi te)))
oComm.Parameter s.Add(New OleDbParameter( "@Rsector", UCASE(Sector)))
oComm.Parameter s.Add(New OleDbParameter( "@Rfunction ", UCASE(Functiona l)))
oComm.Parameter s.Add(New OleDbParameter( "@Ryear", Yroperation))
oComm.Parameter s.Add(New OleDbParameter( "@Rusite", UCASE(Usesite)) )
oComm.Parameter s.Add(New OleDbParameter( "@Rbilladd" , UCASE(Billaddre ss)))
oComm.Parameter s.Add(New OleDbParameter( "@Rbillcty" , UCASE(Billcity) ))
oComm.Parameter s.Add(New OleDbParameter( "@Rbillzip" , UCASE(Billzip)) )
oComm.Parameter s.Add(New OleDbParameter( "@Rbillctr" , UCASE(Billctr)) )
oComm.Parameter s.Add(New OleDbParameter( "@Rflag", UCASE(Resumefla g)))
oComm.Parameter s.Add(New OleDbParameter( "@RRemail", Resumeemail))
oComm.Parameter s.Add(New OleDbParameter( "@RRegdate" , now()))
oComm.Parameter s.Add(New OleDbParameter( "@Roffice", UCASE(Officeloc )))
oComm.Parameter s.Add(New OleDbParameter( "@Rapprove" , UCASE(Recapprov e)))
oComm.Parameter s.Add(New OleDbParameter( "@RRapprove ", UCASE(Resumereg )))

oComm.ExecuteNo nQuery()

System.InvalidC astException

Line 65:
Line 66:
Line 67: oComm.ExecuteNo nQuery()
Line 68:
Line 69:
Source File: recruiter\Recok .aspx Line: 67

Stack Trace:

[InvalidCastExce ption: Specified cast is not valid.]
System.Data.Ole Db.DBBindings.s et_Value(Object value) +1886
System.Data.Ole Db.OleDbCommand .GetInputParame ters() +100
System.Data.Ole Db.OleDbCommand .ExecuteCommand Text(Object& executeResult)
+22
System.Data.Ole Db.OleDbCommand .ExecuteCommand (CommandBehavio r behavior,
Object& executeResult) +65
System.Data.Ole Db.OleDbCommand .ExecuteReaderI nternal(Command Behavior
behavior, String method) +112
System.Data.Ole Db.OleDbCommand .ExecuteNonQuer y() +66

[TargetInvocatio nException: Exception has been thrown by the target of an
invocation.]
System.Reflecti on.RuntimeMetho dInfo.InternalI nvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean isBinderDefault , Assembly caller, Boolean verifyAccess) +0
System.Reflecti on.RuntimeMetho dInfo.InternalI nvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean verifyAccess) +425
System.Reflecti on.RuntimeMetho dInfo.Invoke(Ob ject obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +23
Microsoft.Visua lBasic.Compiler Services.LateBi nding.FastCall( Object o,
MethodBase method, ParameterInfo[] Parameters, Object[] args, Type objType,
IReflect objIReflect) +247
Microsoft.Visua lBasic.Compiler Services.LateBi nding.InternalL ateCall(Object
o, Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack, Boolean IgnoreReturn) +435

Microsoft.Visua lBasic.Compiler Services.LateBi nding.LateCall( Object o,
Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack) +23
ASP.Recok_aspx. __Render__contr ol1(HtmlTextWri ter __output, Control
parameterContai ner) in
c:\websites\man agersp65\manage rsp.com\newinas px\recruiter\Re cok.aspx:67
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer) +27
System.Web.UI.C ontrol.Render(H tmlTextWriter writer) +7
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer) +243
System.Web.UI.P age.ProcessRequ estMain() +1926

I am not using any codebehinds but passing the session variables from a
procedure which is called at the time of button press event is fired.
Please help me to solve this problem.
Nov 19 '05 #1
4 2668
Hey Buddy,

You are trying insert a record with some improper casting, I guess. When
yoiu are printing or displaying you mightn't 've done any casting.

Try running your app after removing the the UCASE coversion for some of the
vairables like
Billzip, Mobile etc.

If you still get same error...then you need to add parameters one by one to
the query and you have to find, which variable is causing this error.

Cheers,

Jerome. M
"DOTNET" wrote:
Hi,

Anybody help me regarding this error:

I am assigning the values to the session variables when the button is
clicked and passing these session variables to the next page and when I am
printing these session variables they are printing. After that I am
assigning these things in hidden object and in the form submit action I am
receiving these hidden values like the following:

dim Recname = Request("Recnam e")
dim Contactname = Request("Contac tname")
dim CompAddress = Request("Compad dress")
dim city = Request("City")
dim ZipCode = Request("Zipcod e")
dim Country = Request("Countr y")
dim TelePhone = Request("Teleph one")
dim Mobile = Request("Mobile ")
dim Email = Request("Emaili d")
dim Companysite = Request("Compan ysite")
dim Sector = Request("Sector ")
dim Functional = Request("Functi onal")
dim Yroperation = Request("Yroper ation")
dim Officeloc = Request("Office loc")
dim Usesite = Request("Usesit e")
dim Billaddress = Request("Billad dress")
dim Billcity = Request("Billci ty")
dim Billzip = Request("Billzi p")
dim Billctr = Request("Billco untry")
dim Resumeflag = Request("Resume flag")
dim Resumeemail = Request("Resume email")
dim Resumereg = "NO"
dim Recapprove = "YES"
Here also I succeeded when I am printing these declared variables with
assigned values. But when I am trying to insert these vales into the table
created in MS-Access like the following it is producing the given error:

sSQL = "INSERT INTO RECRUITERS
(Recname,Contna me,Recaddress,R eccity,ReczipCo de,Reccountry,R ecTelephone,Rec mobile,Recemail ,Recsite,Recsec tor,Recfunction al,Recyroper,Re cusesite,Recbil laddress,Recbil lcity,Recbillzi p,Recbillcountr y,Recresumeflag ,Recresumemail, Regdate,Recoffi celocations,Rec approve,Recappr overes)
values
(@Rname,@Contna me,@Raddress,@R city,@Rzip,@Rco untry,@Rphone,@ Rmobile,@Remail ,@Rsite,@Rsecto r,@Rfunction,@R year,@Rusite,@R billadd,@Rbillc ty,@Rbillzip,@R billctr,@Rflag, @RRemail,@RRegd ate,@Roffice,@R approve,@RRappr ove)"

oComm = New OleDbCommand(sS QL, oConn)
oComm.Commandty pe = CommandType.Tex t

oComm.Parameter s.Add(New OleDbParameter( "@Rname", UCASE(Recname)) )
oComm.Parameter s.Add(New OleDbParameter( "@Contname" , UCASE(Contactna me)))
oComm.Parameter s.Add(New OleDbParameter( "@Raddress" , UCASE(Compaddre ss)))
oComm.Parameter s.Add(New OleDbParameter( "@RCity", UCASE(City)))
oComm.Parameter s.Add(New OleDbParameter( "@Rzip", Zipcode))
oComm.Parameter s.Add(New OleDbParameter( "@Rcountry" , UCASE(Country)) )
oComm.Parameter s.Add(New OleDbParameter( "@Rphone", UCASE(Telephone )))
oComm.Parameter s.Add(New OleDbParameter( "@Rmobile", UCASE(Mobile)))
oComm.Parameter s.Add(New OleDbParameter( "@Remail", UCASE(Email)))
oComm.Parameter s.Add(New OleDbParameter( "@Rsite", UCASE(Companysi te)))
oComm.Parameter s.Add(New OleDbParameter( "@Rsector", UCASE(Sector)))
oComm.Parameter s.Add(New OleDbParameter( "@Rfunction ", UCASE(Functiona l)))
oComm.Parameter s.Add(New OleDbParameter( "@Ryear", Yroperation))
oComm.Parameter s.Add(New OleDbParameter( "@Rusite", UCASE(Usesite)) )
oComm.Parameter s.Add(New OleDbParameter( "@Rbilladd" , UCASE(Billaddre ss)))
oComm.Parameter s.Add(New OleDbParameter( "@Rbillcty" , UCASE(Billcity) ))
oComm.Parameter s.Add(New OleDbParameter( "@Rbillzip" , UCASE(Billzip)) )
oComm.Parameter s.Add(New OleDbParameter( "@Rbillctr" , UCASE(Billctr)) )
oComm.Parameter s.Add(New OleDbParameter( "@Rflag", UCASE(Resumefla g)))
oComm.Parameter s.Add(New OleDbParameter( "@RRemail", Resumeemail))
oComm.Parameter s.Add(New OleDbParameter( "@RRegdate" , now()))
oComm.Parameter s.Add(New OleDbParameter( "@Roffice", UCASE(Officeloc )))
oComm.Parameter s.Add(New OleDbParameter( "@Rapprove" , UCASE(Recapprov e)))
oComm.Parameter s.Add(New OleDbParameter( "@RRapprove ", UCASE(Resumereg )))

oComm.ExecuteNo nQuery()

System.InvalidC astException

Line 65:
Line 66:
Line 67: oComm.ExecuteNo nQuery()
Line 68:
Line 69:
Source File: recruiter\Recok .aspx Line: 67

Stack Trace:

[InvalidCastExce ption: Specified cast is not valid.]
System.Data.Ole Db.DBBindings.s et_Value(Object value) +1886
System.Data.Ole Db.OleDbCommand .GetInputParame ters() +100
System.Data.Ole Db.OleDbCommand .ExecuteCommand Text(Object& executeResult)
+22
System.Data.Ole Db.OleDbCommand .ExecuteCommand (CommandBehavio r behavior,
Object& executeResult) +65
System.Data.Ole Db.OleDbCommand .ExecuteReaderI nternal(Command Behavior
behavior, String method) +112
System.Data.Ole Db.OleDbCommand .ExecuteNonQuer y() +66

[TargetInvocatio nException: Exception has been thrown by the target of an
invocation.]
System.Reflecti on.RuntimeMetho dInfo.InternalI nvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean isBinderDefault , Assembly caller, Boolean verifyAccess) +0
System.Reflecti on.RuntimeMetho dInfo.InternalI nvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean verifyAccess) +425
System.Reflecti on.RuntimeMetho dInfo.Invoke(Ob ject obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +23
Microsoft.Visua lBasic.Compiler Services.LateBi nding.FastCall( Object o,
MethodBase method, ParameterInfo[] Parameters, Object[] args, Type objType,
IReflect objIReflect) +247
Microsoft.Visua lBasic.Compiler Services.LateBi nding.InternalL ateCall(Object
o, Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack, Boolean IgnoreReturn) +435

Microsoft.Visua lBasic.Compiler Services.LateBi nding.LateCall( Object o,
Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack) +23
ASP.Recok_aspx. __Render__contr ol1(HtmlTextWri ter __output, Control
parameterContai ner) in
c:\websites\man agersp65\manage rsp.com\newinas px\recruiter\Re cok.aspx:67
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer) +27
System.Web.UI.C ontrol.Render(H tmlTextWriter writer) +7
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer) +243
System.Web.UI.P age.ProcessRequ estMain() +1926

I am not using any codebehinds but passing the session variables from a
procedure which is called at the time of button press event is fired.
Please help me to solve this problem.

Nov 19 '05 #2
Turn Option Strict ON. Once you have fixed up all the errors that this
causes in the compiler with your code as it now stands, it should work fine.

This is one of the areas of VB that I have always hated. VB6 and before used
variants and late-binding instead of "real" variables. As a result, we have
an entire class of programmers who don't even know what a data type is.
VB.Net has to work with real data types, but it allows (and in VS.Net 2003
and earlier by default) you to turn Option Strict OFF and use Late-Binding.
And here is the fruit of it.

Data is stored in memory. When a program has to store data in memory, how
does it know how much memory to allocate to the data? By the data type. An
Integer (Int32) is a 32-bit (4 byte) storage space. A string is the size of
the number of characters in the string, multiplied by 2 if it's Unicode, in
bytes. An array is the size of each element in the array multiplied by the
number of bytes in each element.

The data type also indicates to the program how the data should be treated.
Under the covers, it's all bits and bytes, 1s and 0s. But you don't treat a
string like a number. A Unicode character is actually a 2-byte number, but
it is treated like a character, and a string is an array of Unicode
characters. So, the string "foo" is actually a 6-byte array (or a
3-character array) of Unicode characters.

Okay, so how does this all relate to your issue (I bet you were wondering
when and if I would get to that!)?

Well, let's start from the beginning. First, you assign the values of a form
post operation to a bunch of variables, which are, at this point, of type
Object. You use the Request class, so these values from the Request are all
strings. Why? Because a Request is a text document that is sent from the
browser to the server. Everything in it is text.

Now you have a bunch of variables of type Object storing a bunch of strings.
So far so good. At this point I might mention that Object is NOT the same as
Variant. Object is a class, the base class for all .Net classes. As such, it
is possible to store any type of data in a variable of type Object
(everything in .Net IS an object, more or less). Think of it like this:
Every man is a human. Every woman is a human. But every man is NOT a woman.

Okay, now you want to plug these into your query. And that's where the rub
lies. You're assigning strings to EVERY field in your table. And I would
strongly suspect that they are not all text columns. For example, I would
suspect that the YES and NO values are going into an Access Yes/No column,
which is a Boolean data type (a 1-bit number, either 1 or 0, true or false).
Suddenly, the database is expecting a Boolean value, and you're passing a
string. Hence, InvalidCastExce ption.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"DOTNET" <se************ ****@gmail.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
Hi,

Anybody help me regarding this error:

I am assigning the values to the session variables when the button is
clicked and passing these session variables to the next page and when I am
printing these session variables they are printing. After that I am
assigning these things in hidden object and in the form submit action I am
receiving these hidden values like the following:

dim Recname = Request("Recnam e")
dim Contactname = Request("Contac tname")
dim CompAddress = Request("Compad dress")
dim city = Request("City")
dim ZipCode = Request("Zipcod e")
dim Country = Request("Countr y")
dim TelePhone = Request("Teleph one")
dim Mobile = Request("Mobile ")
dim Email = Request("Emaili d")
dim Companysite = Request("Compan ysite")
dim Sector = Request("Sector ")
dim Functional = Request("Functi onal")
dim Yroperation = Request("Yroper ation")
dim Officeloc = Request("Office loc")
dim Usesite = Request("Usesit e")
dim Billaddress = Request("Billad dress")
dim Billcity = Request("Billci ty")
dim Billzip = Request("Billzi p")
dim Billctr = Request("Billco untry")
dim Resumeflag = Request("Resume flag")
dim Resumeemail = Request("Resume email")
dim Resumereg = "NO"
dim Recapprove = "YES"
Here also I succeeded when I am printing these declared variables with
assigned values. But when I am trying to insert these vales into the table
created in MS-Access like the following it is producing the given error:

sSQL = "INSERT INTO RECRUITERS
(Recname,Contna me,Recaddress,R eccity,ReczipCo de,Reccountry,R ecTelephone,Rec mobile,Recemail ,Recsite,Recsec tor,Recfunction al,Recyroper,Re cusesite,Recbil laddress,Recbil lcity,Recbillzi p,Recbillcountr y,Recresumeflag ,Recresumemail, Regdate,Recoffi celocations,Rec approve,Recappr overes)
values
(@Rname,@Contna me,@Raddress,@R city,@Rzip,@Rco untry,@Rphone,@ Rmobile,@Remail ,@Rsite,@Rsecto r,@Rfunction,@R year,@Rusite,@R billadd,@Rbillc ty,@Rbillzip,@R billctr,@Rflag, @RRemail,@RRegd ate,@Roffice,@R approve,@RRappr ove)"

oComm = New OleDbCommand(sS QL, oConn)
oComm.Commandty pe = CommandType.Tex t

oComm.Parameter s.Add(New OleDbParameter( "@Rname", UCASE(Recname)) )
oComm.Parameter s.Add(New OleDbParameter( "@Contname" , UCASE(Contactna me)))
oComm.Parameter s.Add(New OleDbParameter( "@Raddress" , UCASE(Compaddre ss)))
oComm.Parameter s.Add(New OleDbParameter( "@RCity", UCASE(City)))
oComm.Parameter s.Add(New OleDbParameter( "@Rzip", Zipcode))
oComm.Parameter s.Add(New OleDbParameter( "@Rcountry" , UCASE(Country)) )
oComm.Parameter s.Add(New OleDbParameter( "@Rphone", UCASE(Telephone )))
oComm.Parameter s.Add(New OleDbParameter( "@Rmobile", UCASE(Mobile)))
oComm.Parameter s.Add(New OleDbParameter( "@Remail", UCASE(Email)))
oComm.Parameter s.Add(New OleDbParameter( "@Rsite", UCASE(Companysi te)))
oComm.Parameter s.Add(New OleDbParameter( "@Rsector", UCASE(Sector)))
oComm.Parameter s.Add(New OleDbParameter( "@Rfunction ", UCASE(Functiona l)))
oComm.Parameter s.Add(New OleDbParameter( "@Ryear", Yroperation))
oComm.Parameter s.Add(New OleDbParameter( "@Rusite", UCASE(Usesite)) )
oComm.Parameter s.Add(New OleDbParameter( "@Rbilladd" , UCASE(Billaddre ss)))
oComm.Parameter s.Add(New OleDbParameter( "@Rbillcty" , UCASE(Billcity) ))
oComm.Parameter s.Add(New OleDbParameter( "@Rbillzip" , UCASE(Billzip)) )
oComm.Parameter s.Add(New OleDbParameter( "@Rbillctr" , UCASE(Billctr)) )
oComm.Parameter s.Add(New OleDbParameter( "@Rflag", UCASE(Resumefla g)))
oComm.Parameter s.Add(New OleDbParameter( "@RRemail", Resumeemail))
oComm.Parameter s.Add(New OleDbParameter( "@RRegdate" , now()))
oComm.Parameter s.Add(New OleDbParameter( "@Roffice", UCASE(Officeloc )))
oComm.Parameter s.Add(New OleDbParameter( "@Rapprove" , UCASE(Recapprov e)))
oComm.Parameter s.Add(New OleDbParameter( "@RRapprove ", UCASE(Resumereg )))

oComm.ExecuteNo nQuery()

System.InvalidC astException

Line 65:
Line 66:
Line 67: oComm.ExecuteNo nQuery()
Line 68:
Line 69:
Source File: recruiter\Recok .aspx Line: 67

Stack Trace:

[InvalidCastExce ption: Specified cast is not valid.]
System.Data.Ole Db.DBBindings.s et_Value(Object value) +1886
System.Data.Ole Db.OleDbCommand .GetInputParame ters() +100
System.Data.Ole Db.OleDbCommand .ExecuteCommand Text(Object& executeResult)
+22
System.Data.Ole Db.OleDbCommand .ExecuteCommand (CommandBehavio r behavior,
Object& executeResult) +65
System.Data.Ole Db.OleDbCommand .ExecuteReaderI nternal(Command Behavior
behavior, String method) +112
System.Data.Ole Db.OleDbCommand .ExecuteNonQuer y() +66

[TargetInvocatio nException: Exception has been thrown by the target of an
invocation.]
System.Reflecti on.RuntimeMetho dInfo.InternalI nvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean isBinderDefault , Assembly caller, Boolean verifyAccess)
+0
System.Reflecti on.RuntimeMetho dInfo.InternalI nvoke(Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean verifyAccess) +425
System.Reflecti on.RuntimeMetho dInfo.Invoke(Ob ject obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +23
Microsoft.Visua lBasic.Compiler Services.LateBi nding.FastCall( Object o,
MethodBase method, ParameterInfo[] Parameters, Object[] args, Type
objType, IReflect objIReflect) +247

Microsoft.Visua lBasic.Compiler Services.LateBi nding.InternalL ateCall(Object
o, Type objType, String name, Object[] args, String[] paramnames,
Boolean[] CopyBack, Boolean IgnoreReturn) +435

Microsoft.Visua lBasic.Compiler Services.LateBi nding.LateCall( Object o,
Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack) +23
ASP.Recok_aspx. __Render__contr ol1(HtmlTextWri ter __output, Control
parameterContai ner) in
c:\websites\man agersp65\manage rsp.com\newinas px\recruiter\Re cok.aspx:67
System.Web.UI.C ontrol.RenderCh ildren(HtmlText Writer writer) +27
System.Web.UI.C ontrol.Render(H tmlTextWriter writer) +7
System.Web.UI.C ontrol.RenderCo ntrol(HtmlTextW riter writer) +243
System.Web.UI.P age.ProcessRequ estMain() +1926

I am not using any codebehinds but passing the session variables from a
procedure which is called at the time of button press event is fired.
Please help me to solve this problem.

Nov 19 '05 #3
Could it be:

When you passing "YES"/"NO" as a parameters for fields RRapprove,Rappr ove
they don't get converted to "1"/"0"
("1"/"0" - considered by sql as binary and "YES"/"NO"/"TRUE"/"FALSE" are not)

Nov 19 '05 #4
You can pass true/false into a parameter as long as you give its datatype as
SqlDbType.Bit.

SqlParameter p = new SqlParameter( "@RRaprove" , SqlDbType.Bit );
p.Value = true;
myCommand.Param eters.Add( p )

It will do the necessary 1/0 conversion for you.

HTH,

bill

"NotHelpful " <No********@dis cussions.micros oft.com> wrote in message
news:5E******** *************** ***********@mic rosoft.com...
Could it be:

When you passing "YES"/"NO" as a parameters for fields RRapprove,Rappr ove
they don't get converted to "1"/"0"
("1"/"0" - considered by sql as binary and "YES"/"NO"/"TRUE"/"FALSE" are not)

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1137
by: lover | last post by:
in the vb.old days we used to be able to do something like \\\ sub on local error goto typeMismatchHandler _someIntegerVariable = _someVariableThatMightBeNothingOrNull _anotherIntegerVariable = _anotherVariableThatMightBeNothingOrNull _yetAnotherIntegerVariable = _yetAnotherVariableThatMightBeNothingOrNull exit sub
7
4717
by: Julien | last post by:
Hi !!! I hav a problem when I try to initialize my workbook (opening or creation) in my windows form... I got the Exception 'System.InvalidCastException' : QueryInterface for interface Excel._Application failed I tried to change de CultureInfo but it doesn't work better.
11
3132
by: Roy Lawson | last post by:
I have no idea what is going on here. I wrote a simple application in VB.NET to generate a Crystal Report, and I am now trying to move it to ASP.NET with Crstal Enterprise. I wish I could tell you how the report works...but I can't even get past connecting to the database :-) I use the typical: Dim oConnection As New SqlConnection(strCon) Dim cmdText As String = "SELECT * FROM viewLogin WHERE " & _
6
6432
by: Biva | last post by:
Hello All, Please help. I get the following error from my webpage: System.InvalidCastException: Specified cast is not valid. at Time.MaintAtRiskProjects.UpdateProject(String Project, String AtRiskCode, String Comment) Code for UpdateProject(String Project, String AtRiskCode, String Comment) is:
0
623
by: QA | last post by:
I am using a Business Scorecard Accelarator in a Sharepoint Portal 2003 using SQL Server 2005 I am getting the following error: Error,5/7/2005 10:50:14 AM,580,AUE1\Administrator,"Specified cast is not valid.","Microsoft.BusinessIntelligence.Scorecard.ScorecardException: Specified cast is not valid. ---> Microsoft.BusinessIntelligence.Scorecard.ScorecardException: Specified cast is not valid. ---> System.InvalidCastException: Specified...
1
2962
by: Mark Hollander | last post by:
Hi, I am using the WMI management object to obtain values about the network cards installed on the system. The MSDN tells me the following class Win32_NetworkAdapterConfiguration : CIM_Setting { ... datetime DHCPLeaseExpires;
1
6385
by: Ben | last post by:
Hi I have a program that has just been developed on a machine running VS .NET 2003, we installed VS6 on the same machine and now we receive the below error on click event. The on click event doesent even seem to fire? An unhandled exception of type 'System.InvalidCastException' occurred in system.windows.forms.dll
0
952
by: prasanth1802 | last post by:
string Empid = e.Item.Cells.Text; string Empname = ((TextBox)e.Item.Cells.Controls).Text; string date = ((TextBox)e.Item.Cells.Controls).Text; string Special=((TextBox)e.Item.Cells.Controls).Text; string Sex=((TextBox)e.Item.Cells.Controls).Text; am getting Specified cast is not valid. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more...
4
1847
by: rsdev | last post by:
Hi, I have an InvalidCastException which is completely puzzling me. I have checked all the members in the stored procedure against my data provider and seems to be ok. Also in the stack trace it says ProcessRequestMain... +3742?? Here's the error; Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in...
0
9879
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9727
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10643
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10705
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9477
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7879
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5907
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3158
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.