Hi,
I used SQL Server 2000 Personal Edition. I created a stored procedure
having input parameters as smallint,tinyint,char,varchar and
smalldatetime. When I executed it by Query Analyzer, it's ok. But when
I executed it by ASP code that used ADODB.command, it showed error:
Invalid character value for cast specification .
Though SQL Server debugger, it showed:
[Microsoft][ODBC SQL Server Driver]Invalid character value for cast
specification
What did I do wrong? How do I fix this problem?
TIA
Krung
PS: One of input parameters was smalldatetime, but I casting it in ASP
as date as:
Const adDate=7
datetxt='2004/6/28'
cmd.Parameters.Append cmd.CreateParameter("CoopId",adChar,
adParamInput, 8, coopid)
cmd.Parameters.Append cmd.CreateParameter("Addr",adVarChar,
adParamInput, 100, addr)
...
cmd.Parameters.Append cmd.CreateParameter("Cdate",adDate,
adParamInput, , datetxt)
....
cmd.execute 3 30995
Krung Saengpole (sa*******@lycosasia.com) writes: I used SQL Server 2000 Personal Edition. I created a stored procedure having input parameters as smallint,tinyint,char,varchar and smalldatetime. When I executed it by Query Analyzer, it's ok. But when I executed it by ASP code that used ADODB.command, it showed error: Invalid character value for cast specification .
Though SQL Server debugger, it showed: [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification
What did I do wrong? How do I fix this problem? TIA Krung
PS: One of input parameters was smalldatetime, but I casting it in ASP as date as:
Const adDate=7 datetxt='2004/6/28'
ODBC want dates on the form YYYY-MM-DD, did you try that.
By the way, appearently you are using the MSDASQL provider, that is
OLE DB over ODBC. I recommend you to switch to SQLOLEDB instead. Not
that this would change this particular case, but SQLOLEDB is
recommended in general, and MSDASQL is deprecated for SQL Server
access.
The change to do is to rip out "Driver={SQL Server}" from the connect
string and bump in "Provider=SQLOLEDB". You may need to do more, but
try that for a start.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se
Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp
I tried both YYYY/MM/DD and YYYY-MM-DD format, and also used SQLOLEDB
provider. I'm not sure trouble happened with datetime point. But other
stored procedures that don't use datetime parameter works ok.
TIA
Krung
Erland Sommarskog <es****@sommarskog.se> wrote in message > > PS: One of input parameters was smalldatetime, but I casting it in ASP as date as:
Const adDate=7 datetxt='2004/6/28'
ODBC want dates on the form YYYY-MM-DD, did you try that.
By the way, appearently you are using the MSDASQL provider, that is OLE DB over ODBC. I recommend you to switch to SQLOLEDB instead. Not that this would change this particular case, but SQLOLEDB is recommended in general, and MSDASQL is deprecated for SQL Server access.
The change to do is to rip out "Driver={SQL Server}" from the connect string and bump in "Provider=SQLOLEDB". You may need to do more, but try that for a start.
Krung Saengpole (sa*******@lycosasia.com) writes: Though SQL Server debugger, it showed: [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification
What did I do wrong? How do I fix this problem? TIA Krung
PS: One of input parameters was smalldatetime, but I casting it in ASP as date as:
Const adDate=7 datetxt='2004/6/28' cmd.Parameters.Append cmd.CreateParameter("CoopId",adChar, adParamInput, 8, coopid) cmd.Parameters.Append cmd.CreateParameter("Addr",adVarChar, adParamInput, 100, addr) ... cmd.Parameters.Append cmd.CreateParameter("Cdate",adDate, adParamInput, , datetxt) .... cmd.execute
Sorry, I missed the real error. You should probably use adDBTimeStamp (135),
adDate. adDate values are floats.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se
Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ken Lindner |
last post by:
I have a need to become familiar with SQL Server 2000 for work.
Needless to say I am new to SQL Server any version, but not IT in
general. My employer has provided me with the SQL Server 2000...
|
by: M Wells |
last post by:
Hi All,
I have a table that holds pregenerated member IDs.
This table is used to assign an available member id to web site
visitors who choose to register with the site
So, conceptually the...
|
by: jaYPee |
last post by:
I have converted access 97 to access xp project and connect the table
from my sql server 2000. my problem is that when i run my report it
says "Invalid SQL Statement. Check the server filter on the...
|
by: xo55ox |
last post by:
After setting up the linked server connection at the standby server, I
tried to xcopy a file through the sql server 2000 schedule task to the
standby server's shared directory. But it keeps giving...
|
by: wiredog |
last post by:
I am struggling rewriting my query from MS Access' IIF, Then to SQL
Servers TSQL language. I am hoping some one can give me some
guidance. I believe I have the first portion of the query correct...
|
by: mariantrygg |
last post by:
Set qdf = dbs.QueryDefs("qryUpdate_OMNIS_F_ST_Transactions") 'append
qdf.Parameters(0) = DMax("STTR_SEQ", "CopyOMNIS_F_ST_Transaction")
qdf.Execute dbSeeChanges
This gives me an error 3146...
|
by: King Kong |
last post by:
we are facing this kind of error when we double click the infragistic web
grid
please help me on this
Regards
Moid Iqbal
Server Error in '/NetworkAccess' Application....
|
by: jschmidt |
last post by:
Hi Everyone,
I am trying to link a table in MS Access 2000. When I create the table there is a field called "Location" that is defined as a varchar(25). The linked table shows the Location field...
|
by: brian.j.parker |
last post by:
One of the developers where I work found that some of his code would
regularly cause index corruption in SQL Server 2000, post-sp4.
@@version is 8.00.2050 and I can repeat this, so I can't...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
| |