Solved

adVarWChar doesnt work for nvarchar

Posted on 2007-03-21
3
2,493 Views
Last Modified: 2008-01-09
Hi experts,

One field in my table is set as nvarchar for keeping unicode stuff.  I find my ASP page 's not working smooth. Here are my StoredProc and ASP.

My Stored Proc
-------------------
@ChineseName nvarchar(50),
@StaffExpDate varchar(10)

My ASP
-------------------
Set objParam = .Parameters
objParam.Append .CreateParameter("@ChineseName", adVarWChar, adParamInput, 50, strChineseName)
objParam.Append .CreateParameter("@StaffExpDate", adVarChar, adParamInput, 10, dStaffExpDate)

In my SP, for Chinese Name, if I change to varchar(50),
and change my ASP to
objParam.Append .CreateParameter("@ChineseName", adVarChar, adParamInput, 50, strChineseName),
I can update the stuff without any problem.

However, if I stick with that nvarchar in SP, adVarWChar in ASP, it will show the error
Microsoft OLE DB Provider for SQL Server error '80040e07'

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

I m wondering, would adVarWChar really suitable for nvarchar? Or would there be any better options?

Thanks,
Manfred


0
Comment
Question by:manfredino
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 10

Expert Comment

by:lahousden
ID: 18763755
What is the character representation of the date that you are passing in to the Stored Procedure?
0
 
LVL 29

Accepted Solution

by:
Nightman earned 50 total points
ID: 18764793
adVarWChar is suitable for Chines characters. However, neither nvarchar or varchar are really suitable for dates. You should be using datetime datatype.

As per lahousden's question, what does the data look like that you are passing into the procedure?
0
 

Author Comment

by:manfredino
ID: 18768777
adVarWChar works now!

as for the codings previously made , there are several other date fields. In asp, they were set as adVarChar under DD-MM-YYYY format, then in the Stored Proc, dates with DD-MM-YYYY format would be converted like select @tmpChgEndDate=convert(datetime,substring(@ChgEndDate,4,2)+'-'+substring(@ChgEndDate,1,2)+'-'+substring(@ChgEndDate,7,4)) to make it as DD/MM/YYYY

Thanks a lot lahousden & Nightman! Thanks for your advices!
 
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question