473,804 Members | 3,399 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.CreateOb ject("ADODB.Com mand")
CmdAddPr.Active Connection = MM_Intranet_STR ING
CmdAddPr.Comman dText = "dbo.AddPressRe lease"
CmdAddPr.Comman dType = 4
CmdAddPr.Comman dTimeout = 0
CmdAddPr.Prepar ed = true
CmdAddPr.Parame ters.Append CmdAddPr.Create Parameter("@RET URN_VALUE",
3, 4)
CmdAddPr.Parame ters.Append
CmdAddPr.Create Parameter("@pre ssreleasedescri ption", 200,
1,250,CmdAddPr_ _pressreleasede scription)

CmdAddPr.Parame ters.Append
CmdAddPr.Create Parameter("@pre ssreleasedate", 135,
1,20,CmdAddPr__ pressreleasedat e)

CmdAddPr.Parame ters.Append CmdAddPr.Create Parameter("@use rname", 200,
1,50,CmdAddPr__ username)

CmdAddPr.Parame ters.Append CmdAddPr.Create Parameter("@las tupdated",
135, 1,20,CmdAddPr__ lastupdated)

CmdAddPr.Parame ters.Append CmdAddPr.Create Parameter("@fil esize", 131,
1,20,CmdAddPr__ filesize)

CmdAddPr.Parame ters.Append CmdAddPr.Create Parameter("@pub lish", 128,
1,20,CmdAddPr__ publish)
CmdAddPr.Execut e()

.....My stored procudure:

CREATE Procedure dbo.AddPressRel ease

@pressreleasede scription varchar(250),
@pressreleaseda te datetime,
@username varchar(50),
@lastupdated datetime,
@filesize numeric,
@publish bit
As
Declare @pressreleaseid int

Select @pressreleaseid = nextpressreleas eid from nextids

Insert into PressReleases(p ressreleaseID,p ressreleasedesc ription,pressre leasedate,usern ame,lastupdated ,filesize,publi sh)
Values (@pressreleasei d,@pressrelease description,@pr essreleasedate, @username,@last updated,@filesi ze,@publish)

Update nextids set nextpressreleas eid = nextpressreleas eid + 1

return @pressreleaseid
GO

.....and my sql server table:

Data type Length
PressReleaseID int 4
PressReleaseDat e datetime 8
Publish bit 1
Username varchar 50
Filesize varchar 50
LastUpdated datetime 8
PressReleaseDes cription varchar 255

Thanks in advance,

Luke
Jul 19 '05 #1
1 4143
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
2264
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 note: I've appended something extra to the version thing in the Makefile - I doubt this is relevant to the problem but it's probably best you have all the info). The complex data type is similar to what I'm trying to do so I've been following that as...
0
1766
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. The application uses Expat 1.95.7 via php to render the xml data. First everything seemed to work fine. But now I noticed that something
0
2881
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 disconnected ADODB.Recordset from System.Data.DataTable data. Below is the source code I am implementing to test the process. I do not get any error, that I can see. The problem I have is that at the end, the recordset seems to be empty. Any...
32
3232
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 lost when they move to a new record. This seems to be the case when there are multiple users. When there is a single user using it, we don't seem to have that problem. It seems that we had this problem when we first converted from an MDB back end...
4
3866
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 that doesn't offer dynamic memory allocation (to be clear: no malloc, no realloc), and with rather tight memory constraints. Writing my own malloc to do dynamic allocation from some static pool isn't really an option, for various reasons, not...
1
4575
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 the program raises an exception without any information :( I am adding all of the columns the same way, its only the boolean type which gives the problems:
2
2317
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 them.. is there a sheet somewhere or a refrence for them? all i really need to know is Access ADO.NET Numeric Integer/numeric? Memo VarWChar? Text VarWChar? Date/Time ?...
3
2955
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 when converted to XML... Any specific answers? <%@ Language=VBScript %>
4
2023
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 columntype as variant Set db = CurrentDb()
0
9576
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
10567
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10323
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
10310
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
10074
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6847
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5515
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4291
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
2
3809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.