473,411 Members | 2,059 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Data type problem, something to do with datatypeEnum??

Hi all.

I'm having trouble connecting to my sql server database correctly
beacause of value type problems, specifically the date fields. When i
try and run the page i get the follwoing error:

'Application uses a value of the wrong type for the current
operation.'

I beleive the problem is releated to DatatypeEnum values. At the
moment i have the date fields set to 135, but whatever i try i cant
seem to it to work.

I would be very greatful if someone could spot where i'm going wrong.

Datatbase connection:
set CmdAddPr = Server.CreateObject("ADODB.Command")
CmdAddPr.ActiveConnection = MM_Intranet_STRING
CmdAddPr.CommandText = "dbo.AddPressRelease"
CmdAddPr.CommandType = 4
CmdAddPr.CommandTimeout = 0
CmdAddPr.Prepared = true
CmdAddPr.Parameters.Append CmdAddPr.CreateParameter("@RETURN_VALUE",
3, 4)
CmdAddPr.Parameters.Append
CmdAddPr.CreateParameter("@pressreleasedescription ", 200,
1,250,CmdAddPr__pressreleasedescription)

CmdAddPr.Parameters.Append
CmdAddPr.CreateParameter("@pressreleasedate", 135,
1,20,CmdAddPr__pressreleasedate)

CmdAddPr.Parameters.Append CmdAddPr.CreateParameter("@username", 200,
1,50,CmdAddPr__username)

CmdAddPr.Parameters.Append CmdAddPr.CreateParameter("@lastupdated",
135, 1,20,CmdAddPr__lastupdated)

CmdAddPr.Parameters.Append CmdAddPr.CreateParameter("@filesize", 131,
1,20,CmdAddPr__filesize)

CmdAddPr.Parameters.Append CmdAddPr.CreateParameter("@publish", 128,
1,20,CmdAddPr__publish)
CmdAddPr.Execute()

.....My stored procudure:

CREATE Procedure dbo.AddPressRelease

@pressreleasedescription varchar(250),
@pressreleasedate datetime,
@username varchar(50),
@lastupdated datetime,
@filesize numeric,
@publish bit
As
Declare @pressreleaseid int

Select @pressreleaseid = nextpressreleaseid from nextids

Insert into PressReleases(pressreleaseID,pressreleasedescripti on,pressreleasedate,username,lastupdated,filesize, publish)
Values (@pressreleaseid,@pressreleasedescription,@pressre leasedate,@username,@lastupdated,@filesize,@publis h)

Update nextids set nextpressreleaseid = nextpressreleaseid + 1

return @pressreleaseid
GO

.....and my sql server table:

Data type Length
PressReleaseID int 4
PressReleaseDate datetime 8
Publish bit 1
Username varchar 50
Filesize varchar 50
LastUpdated datetime 8
PressReleaseDescription varchar 255

Thanks in advance,

Luke
Jul 19 '05 #1
1 4127
Lukelrc wrote:
Hi all.

I'm having trouble connecting to my sql server database correctly No, you're not. Your connection is happening correctly. Your problem is in
executing your procedure.
beacause of value type problems, specifically the date fields. When i
try and run the page i get the follwoing error:

'Application uses a value of the wrong type for the current
operation.'

I beleive the problem is releated to DatatypeEnum values. At the
moment i have the date fields set to 135, but whatever i try i cant
seem to it to work.


Parameters with the numeric datatype need to have their NumericScale and
Precision properties set.

Coding the Parameters collection can be tricky, and many free code
generators have been developed, including one that i wrote. It is available
here:
http://www.thrasherwebdesign.com/ind...asp&c=&a=clear

In order to use the code created by this generator, you will need to define
the ADO constant enumerations in your web page. One way to do that is to
#include the adovbs.inc file. A better way is shown here:
http://www.aspfaq.com/show.asp?id=2112

HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #2

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

Similar topics

1
by: Geoff Biggs | last post by:
Evening all, I'm trying to add a new built-in number data type to Python with its own syntax, so I'm working directly with the interpreter rather than creating my own extension module (side...
0
by: Fabian Kr?ger | last post by:
Hello, I got a weird problem and need your help and ideas... I´ve written an php application which imports data in XML format and writes this data to a MySQL database to have a faster access....
0
by: elcc1958 | last post by:
I need to support a VB6 application that will be receiving disconnected ADODB.Recordset from out DotNet solution. Our dotnet solution deals with System.Data.DataTable. I need to populate a...
32
by: Neil Ginsberg | last post by:
We're using SQL Server 7 with an Access 2000 MDB as a front end with ODBC linked tables. I recently created a new set of tables for the app, and users are complaining that unsaved data is being...
4
by: Thomas Paul Diffenbach | last post by:
Can anyone point me to an open source library of /statically allocated/ data structures? I'm writing some code that would benefit from trees, preferably self balancing, but on an embedded system...
1
by: Oliver | last post by:
Hello ! Can anyone reproduce this? I am using WinXP SP1 (MDAC 2.8) with MSVS 2003. I can create a complete database with ADOX and everything works, however if I try to add a Datatype adBoolean...
2
by: Brian Henry | last post by:
is there info about data type conversions between access to ado.net? I have tried a lot of the ones that say oledb data types should work for and get a lot of "data type mismatch" errors using...
3
by: katrinaVictim | last post by:
Please copy and paste the full code source into any .asp page and pull the page from the browser. Make sure all components are up to date. Explain why number1 is treated differently than number2...
4
by: Fester Bestertester | last post by:
Greetings, I'm still using MS Access 2K3 and DAO 3.6 objects (I know, I know, I'm a dinosaur)... I'm traversing through the fields of a table to retrieve their data types, thus, Dim...
1
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...
0
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...
0
Oralloy
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,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.