By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,313 Members | 1,240 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,313 IT Pros & Developers. It's quick & easy.

Anybody help me on this: System.InvalidCastException

P: n/a
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("Recname")
dim Contactname = Request("Contactname")
dim CompAddress = Request("Compaddress")
dim city = Request("City")
dim ZipCode = Request("Zipcode")
dim Country = Request("Country")
dim TelePhone = Request("Telephone")
dim Mobile = Request("Mobile")
dim Email = Request("Emailid")
dim Companysite = Request("Companysite")
dim Sector = Request("Sector")
dim Functional = Request("Functional")
dim Yroperation = Request("Yroperation")
dim Officeloc = Request("Officeloc")
dim Usesite = Request("Usesite")
dim Billaddress = Request("Billaddress")
dim Billcity = Request("Billcity")
dim Billzip = Request("Billzip")
dim Billctr = Request("Billcountry")
dim Resumeflag = Request("Resumeflag")
dim Resumeemail = Request("Resumeemail")
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,Contname,Recaddress,Reccity,ReczipCode,Re ccountry,RecTelephone,Recmobile,Recemail,Recsite,R ecsector,Recfunctional,Recyroper,Recusesite,Recbil laddress,Recbillcity,Recbillzip,Recbillcountry,Rec resumeflag,Recresumemail,Regdate,Recofficelocation s,Recapprove,Recapproveres)
values
(@Rname,@Contname,@Raddress,@Rcity,@Rzip,@Rcountry ,@Rphone,@Rmobile,@Remail,@Rsite,@Rsector,@Rfuncti on,@Ryear,@Rusite,@Rbilladd,@Rbillcty,@Rbillzip,@R billctr,@Rflag,@RRemail,@RRegdate,@Roffice,@Rappro ve,@RRapprove)"

oComm = New OleDbCommand(sSQL, oConn)
oComm.Commandtype = CommandType.Text

oComm.Parameters.Add(New OleDbParameter("@Rname", UCASE(Recname)))
oComm.Parameters.Add(New OleDbParameter("@Contname", UCASE(Contactname)))
oComm.Parameters.Add(New OleDbParameter("@Raddress", UCASE(Compaddress)))
oComm.Parameters.Add(New OleDbParameter("@RCity", UCASE(City)))
oComm.Parameters.Add(New OleDbParameter("@Rzip", Zipcode))
oComm.Parameters.Add(New OleDbParameter("@Rcountry", UCASE(Country)))
oComm.Parameters.Add(New OleDbParameter("@Rphone", UCASE(Telephone)))
oComm.Parameters.Add(New OleDbParameter("@Rmobile", UCASE(Mobile)))
oComm.Parameters.Add(New OleDbParameter("@Remail", UCASE(Email)))
oComm.Parameters.Add(New OleDbParameter("@Rsite", UCASE(Companysite)))
oComm.Parameters.Add(New OleDbParameter("@Rsector", UCASE(Sector)))
oComm.Parameters.Add(New OleDbParameter("@Rfunction", UCASE(Functional)))
oComm.Parameters.Add(New OleDbParameter("@Ryear", Yroperation))
oComm.Parameters.Add(New OleDbParameter("@Rusite", UCASE(Usesite)))
oComm.Parameters.Add(New OleDbParameter("@Rbilladd", UCASE(Billaddress)))
oComm.Parameters.Add(New OleDbParameter("@Rbillcty", UCASE(Billcity)))
oComm.Parameters.Add(New OleDbParameter("@Rbillzip", UCASE(Billzip)))
oComm.Parameters.Add(New OleDbParameter("@Rbillctr", UCASE(Billctr)))
oComm.Parameters.Add(New OleDbParameter("@Rflag", UCASE(Resumeflag)))
oComm.Parameters.Add(New OleDbParameter("@RRemail", Resumeemail))
oComm.Parameters.Add(New OleDbParameter("@RRegdate", now()))
oComm.Parameters.Add(New OleDbParameter("@Roffice", UCASE(Officeloc)))
oComm.Parameters.Add(New OleDbParameter("@Rapprove", UCASE(Recapprove)))
oComm.Parameters.Add(New OleDbParameter("@RRapprove", UCASE(Resumereg)))

oComm.ExecuteNonQuery()

System.InvalidCastException

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

Stack Trace:

[InvalidCastException: Specified cast is not valid.]
System.Data.OleDb.DBBindings.set_Value(Object value) +1886
System.Data.OleDb.OleDbCommand.GetInputParameters( ) +100
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult)
+22
System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior,
Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior
behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +66

[TargetInvocationException: Exception has been thrown by the target of an
invocation.]
System.Reflection.RuntimeMethodInfo.InternalInvoke (Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess) +0
System.Reflection.RuntimeMethodInfo.InternalInvoke (Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean verifyAccess) +425
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +23
Microsoft.VisualBasic.CompilerServices.LateBinding .FastCall(Object o,
MethodBase method, ParameterInfo[] Parameters, Object[] args, Type objType,
IReflect objIReflect) +247
Microsoft.VisualBasic.CompilerServices.LateBinding .InternalLateCall(Object
o, Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack, Boolean IgnoreReturn) +435

Microsoft.VisualBasic.CompilerServices.LateBinding .LateCall(Object o,
Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack) +23
ASP.Recok_aspx.__Render__control1(HtmlTextWriter __output, Control
parameterContainer) in
c:\websites\managersp65\managersp.com\newinaspx\re cruiter\Recok.aspx:67
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() +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
Share this Question
Share on Google+
4 Replies


P: n/a
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("Recname")
dim Contactname = Request("Contactname")
dim CompAddress = Request("Compaddress")
dim city = Request("City")
dim ZipCode = Request("Zipcode")
dim Country = Request("Country")
dim TelePhone = Request("Telephone")
dim Mobile = Request("Mobile")
dim Email = Request("Emailid")
dim Companysite = Request("Companysite")
dim Sector = Request("Sector")
dim Functional = Request("Functional")
dim Yroperation = Request("Yroperation")
dim Officeloc = Request("Officeloc")
dim Usesite = Request("Usesite")
dim Billaddress = Request("Billaddress")
dim Billcity = Request("Billcity")
dim Billzip = Request("Billzip")
dim Billctr = Request("Billcountry")
dim Resumeflag = Request("Resumeflag")
dim Resumeemail = Request("Resumeemail")
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,Contname,Recaddress,Reccity,ReczipCode,Re ccountry,RecTelephone,Recmobile,Recemail,Recsite,R ecsector,Recfunctional,Recyroper,Recusesite,Recbil laddress,Recbillcity,Recbillzip,Recbillcountry,Rec resumeflag,Recresumemail,Regdate,Recofficelocation s,Recapprove,Recapproveres)
values
(@Rname,@Contname,@Raddress,@Rcity,@Rzip,@Rcountry ,@Rphone,@Rmobile,@Remail,@Rsite,@Rsector,@Rfuncti on,@Ryear,@Rusite,@Rbilladd,@Rbillcty,@Rbillzip,@R billctr,@Rflag,@RRemail,@RRegdate,@Roffice,@Rappro ve,@RRapprove)"

oComm = New OleDbCommand(sSQL, oConn)
oComm.Commandtype = CommandType.Text

oComm.Parameters.Add(New OleDbParameter("@Rname", UCASE(Recname)))
oComm.Parameters.Add(New OleDbParameter("@Contname", UCASE(Contactname)))
oComm.Parameters.Add(New OleDbParameter("@Raddress", UCASE(Compaddress)))
oComm.Parameters.Add(New OleDbParameter("@RCity", UCASE(City)))
oComm.Parameters.Add(New OleDbParameter("@Rzip", Zipcode))
oComm.Parameters.Add(New OleDbParameter("@Rcountry", UCASE(Country)))
oComm.Parameters.Add(New OleDbParameter("@Rphone", UCASE(Telephone)))
oComm.Parameters.Add(New OleDbParameter("@Rmobile", UCASE(Mobile)))
oComm.Parameters.Add(New OleDbParameter("@Remail", UCASE(Email)))
oComm.Parameters.Add(New OleDbParameter("@Rsite", UCASE(Companysite)))
oComm.Parameters.Add(New OleDbParameter("@Rsector", UCASE(Sector)))
oComm.Parameters.Add(New OleDbParameter("@Rfunction", UCASE(Functional)))
oComm.Parameters.Add(New OleDbParameter("@Ryear", Yroperation))
oComm.Parameters.Add(New OleDbParameter("@Rusite", UCASE(Usesite)))
oComm.Parameters.Add(New OleDbParameter("@Rbilladd", UCASE(Billaddress)))
oComm.Parameters.Add(New OleDbParameter("@Rbillcty", UCASE(Billcity)))
oComm.Parameters.Add(New OleDbParameter("@Rbillzip", UCASE(Billzip)))
oComm.Parameters.Add(New OleDbParameter("@Rbillctr", UCASE(Billctr)))
oComm.Parameters.Add(New OleDbParameter("@Rflag", UCASE(Resumeflag)))
oComm.Parameters.Add(New OleDbParameter("@RRemail", Resumeemail))
oComm.Parameters.Add(New OleDbParameter("@RRegdate", now()))
oComm.Parameters.Add(New OleDbParameter("@Roffice", UCASE(Officeloc)))
oComm.Parameters.Add(New OleDbParameter("@Rapprove", UCASE(Recapprove)))
oComm.Parameters.Add(New OleDbParameter("@RRapprove", UCASE(Resumereg)))

oComm.ExecuteNonQuery()

System.InvalidCastException

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

Stack Trace:

[InvalidCastException: Specified cast is not valid.]
System.Data.OleDb.DBBindings.set_Value(Object value) +1886
System.Data.OleDb.OleDbCommand.GetInputParameters( ) +100
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult)
+22
System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior,
Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior
behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +66

[TargetInvocationException: Exception has been thrown by the target of an
invocation.]
System.Reflection.RuntimeMethodInfo.InternalInvoke (Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess) +0
System.Reflection.RuntimeMethodInfo.InternalInvoke (Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean verifyAccess) +425
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +23
Microsoft.VisualBasic.CompilerServices.LateBinding .FastCall(Object o,
MethodBase method, ParameterInfo[] Parameters, Object[] args, Type objType,
IReflect objIReflect) +247
Microsoft.VisualBasic.CompilerServices.LateBinding .InternalLateCall(Object
o, Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack, Boolean IgnoreReturn) +435

Microsoft.VisualBasic.CompilerServices.LateBinding .LateCall(Object o,
Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack) +23
ASP.Recok_aspx.__Render__control1(HtmlTextWriter __output, Control
parameterContainer) in
c:\websites\managersp65\managersp.com\newinaspx\re cruiter\Recok.aspx:67
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() +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

P: n/a
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, InvalidCastException.

--
HTH,

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

"DOTNET" <se****************@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.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("Recname")
dim Contactname = Request("Contactname")
dim CompAddress = Request("Compaddress")
dim city = Request("City")
dim ZipCode = Request("Zipcode")
dim Country = Request("Country")
dim TelePhone = Request("Telephone")
dim Mobile = Request("Mobile")
dim Email = Request("Emailid")
dim Companysite = Request("Companysite")
dim Sector = Request("Sector")
dim Functional = Request("Functional")
dim Yroperation = Request("Yroperation")
dim Officeloc = Request("Officeloc")
dim Usesite = Request("Usesite")
dim Billaddress = Request("Billaddress")
dim Billcity = Request("Billcity")
dim Billzip = Request("Billzip")
dim Billctr = Request("Billcountry")
dim Resumeflag = Request("Resumeflag")
dim Resumeemail = Request("Resumeemail")
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,Contname,Recaddress,Reccity,ReczipCode,Re ccountry,RecTelephone,Recmobile,Recemail,Recsite,R ecsector,Recfunctional,Recyroper,Recusesite,Recbil laddress,Recbillcity,Recbillzip,Recbillcountry,Rec resumeflag,Recresumemail,Regdate,Recofficelocation s,Recapprove,Recapproveres)
values
(@Rname,@Contname,@Raddress,@Rcity,@Rzip,@Rcountry ,@Rphone,@Rmobile,@Remail,@Rsite,@Rsector,@Rfuncti on,@Ryear,@Rusite,@Rbilladd,@Rbillcty,@Rbillzip,@R billctr,@Rflag,@RRemail,@RRegdate,@Roffice,@Rappro ve,@RRapprove)"

oComm = New OleDbCommand(sSQL, oConn)
oComm.Commandtype = CommandType.Text

oComm.Parameters.Add(New OleDbParameter("@Rname", UCASE(Recname)))
oComm.Parameters.Add(New OleDbParameter("@Contname", UCASE(Contactname)))
oComm.Parameters.Add(New OleDbParameter("@Raddress", UCASE(Compaddress)))
oComm.Parameters.Add(New OleDbParameter("@RCity", UCASE(City)))
oComm.Parameters.Add(New OleDbParameter("@Rzip", Zipcode))
oComm.Parameters.Add(New OleDbParameter("@Rcountry", UCASE(Country)))
oComm.Parameters.Add(New OleDbParameter("@Rphone", UCASE(Telephone)))
oComm.Parameters.Add(New OleDbParameter("@Rmobile", UCASE(Mobile)))
oComm.Parameters.Add(New OleDbParameter("@Remail", UCASE(Email)))
oComm.Parameters.Add(New OleDbParameter("@Rsite", UCASE(Companysite)))
oComm.Parameters.Add(New OleDbParameter("@Rsector", UCASE(Sector)))
oComm.Parameters.Add(New OleDbParameter("@Rfunction", UCASE(Functional)))
oComm.Parameters.Add(New OleDbParameter("@Ryear", Yroperation))
oComm.Parameters.Add(New OleDbParameter("@Rusite", UCASE(Usesite)))
oComm.Parameters.Add(New OleDbParameter("@Rbilladd", UCASE(Billaddress)))
oComm.Parameters.Add(New OleDbParameter("@Rbillcty", UCASE(Billcity)))
oComm.Parameters.Add(New OleDbParameter("@Rbillzip", UCASE(Billzip)))
oComm.Parameters.Add(New OleDbParameter("@Rbillctr", UCASE(Billctr)))
oComm.Parameters.Add(New OleDbParameter("@Rflag", UCASE(Resumeflag)))
oComm.Parameters.Add(New OleDbParameter("@RRemail", Resumeemail))
oComm.Parameters.Add(New OleDbParameter("@RRegdate", now()))
oComm.Parameters.Add(New OleDbParameter("@Roffice", UCASE(Officeloc)))
oComm.Parameters.Add(New OleDbParameter("@Rapprove", UCASE(Recapprove)))
oComm.Parameters.Add(New OleDbParameter("@RRapprove", UCASE(Resumereg)))

oComm.ExecuteNonQuery()

System.InvalidCastException

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

Stack Trace:

[InvalidCastException: Specified cast is not valid.]
System.Data.OleDb.DBBindings.set_Value(Object value) +1886
System.Data.OleDb.OleDbCommand.GetInputParameters( ) +100
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult)
+22
System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior,
Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior
behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +66

[TargetInvocationException: Exception has been thrown by the target of an
invocation.]
System.Reflection.RuntimeMethodInfo.InternalInvoke (Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess)
+0
System.Reflection.RuntimeMethodInfo.InternalInvoke (Object obj,
BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo
culture, Boolean verifyAccess) +425
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +23
Microsoft.VisualBasic.CompilerServices.LateBinding .FastCall(Object o,
MethodBase method, ParameterInfo[] Parameters, Object[] args, Type
objType, IReflect objIReflect) +247

Microsoft.VisualBasic.CompilerServices.LateBinding .InternalLateCall(Object
o, Type objType, String name, Object[] args, String[] paramnames,
Boolean[] CopyBack, Boolean IgnoreReturn) +435

Microsoft.VisualBasic.CompilerServices.LateBinding .LateCall(Object o,
Type objType, String name, Object[] args, String[] paramnames, Boolean[]
CopyBack) +23
ASP.Recok_aspx.__Render__control1(HtmlTextWriter __output, Control
parameterContainer) in
c:\websites\managersp65\managersp.com\newinaspx\re cruiter\Recok.aspx:67
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() +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

P: n/a
Could it be:

When you passing "YES"/"NO" as a parameters for fields RRapprove,Rapprove
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

P: n/a
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.Parameters.Add( p )

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

HTH,

bill

"NotHelpful" <No********@discussions.microsoft.com> wrote in message
news:5E**********************************@microsof t.com...
Could it be:

When you passing "YES"/"NO" as a parameters for fields RRapprove,Rapprove
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 discussion thread is closed

Replies have been disabled for this discussion.