CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML





Zone: > NEWSGROUP > Asp.Net Forum > starter_kits_and_source_projects.commerce_starter_kit Tags:
Item Type: NewsGroup Date Entered: 12/30/2003 6:01:48 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 2 Views: 4 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
3 Items, 1 Pages 1 |< << Go >> >|
le9569
Asp.Net User
Converting the nVarchar to nText. Help.12/30/2003 6:01:48 AM

0/0

Hi all,
I want to extend the Description in CMRC_Products table from nVarchar to nText (for more input) but I hit the problem.

In the design mode of the CMRC_Products table, I change from nvarchar to nText

And below is the sp:




CREATE Procedure CMRC_ProductDetail
(
@ProductID int,
@ModelNumber nvarchar(50) OUTPUT,
@ModelName nvarchar(50) OUTPUT,
@ProductImage nvarchar(50) OUTPUT,
@UnitCost money OUTPUT,
@Description ntext
)
AS

SELECT
@ProductID = ProductID,
@ModelNumber = ModelNumber,
@ModelName = ModelName,
@ProductImage = ProductImage,
@UnitCost = UnitCost,
@Description = Description

FROM
CMRC_Products

WHERE
ProductID = @ProductID

GO




The sp itself has an error. I don't truly know why.

In the ProductDB.vb, I change as follow:

Public Function GetProductDetails(ByVal productID As Integer) As ProductDetails

' Create Instance of Connection and Command Object
Dim myConnection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim myCommand As SqlCommand = New SqlCommand("ProductDetail", myConnection)

' Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure

' Add Parameters to SPROC
Dim parameterProductID As SqlParameter = New SqlParameter("@ProductID", SqlDbType.Int, 4)
parameterProductID.Value = productID
myCommand.Parameters.Add(parameterProductID)

Dim parameterUnitCost As SqlParameter = New SqlParameter("@UnitCost", SqlDbType.Money, 8)
parameterUnitCost.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterUnitCost)

Dim parameterModelNumber As SqlParameter = New SqlParameter("@ModelNumber", SqlDbType.NVarChar, 50)
parameterModelNumber.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterModelNumber)

Dim parameterModelName As SqlParameter = New SqlParameter("@ModelName", SqlDbType.NVarChar, 50)
parameterModelName.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterModelName)

Dim parameterProductImage As SqlParameter = New SqlParameter("@ProductImage", SqlDbType.NVarChar, 50)
parameterProductImage.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterProductImage)

Dim parameterDescription As SqlParameter = New SqlParameter("@Description", SqlDbType.NText)
'parameterDescription.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterDescription)

' Open the connection and execute the Command
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()

' Create and Populate ProductDetails Struct using
' Output Params from the SPROC
Dim myProductDetails As ProductDetails = New ProductDetails()

myProductDetails.ModelNumber = CStr(parameterModelNumber.Value)
myProductDetails.ModelName = CStr(parameterModelName.Value)
myProductDetails.ProductImage = CStr(parameterProductImage.Value).Trim()
myProductDetails.UnitCost = CType(parameterUnitCost.Value, Decimal)
myProductDetails.Description = CStr(parameterDescription.Value).Trim()

Return myProductDetails

End Function



It doesn't seem to be working.

How do I change from nVarchar to nText for Description?

Please help.

I do appreciate your help.

le9569
~ le9569 ~
westdh
Asp.Net User
Re: Converting the nVarchar to nText. Help.1/3/2004 7:14:35 AM

0/0

SILLY Question - But I have to ask, did you also modify the table itself?
le9569
Asp.Net User
Re: Converting the nVarchar to nText. Help.1/3/2004 7:51:50 PM

0/0

Thanks for your reply. After a long day reading SQL server, I found out that nText datatype can not be returns as string. What I did is return a dataset.

Thank you.

le9569
~ le9569 ~
3 Items, 1 Pages 1 |< << Go >> >|



Search This Site:


Meet Our Sponsors:



Other Resources:

Problems all over Captivate - macromedia.captivate.general_discussion ... Problems all over Captivate, > ROOT > NEWSGROUP > Adobe-Macromedia Forums > macromedia.captivate. ... converting the nvarchar to ntext. help. ...
IE's DOM interfaces - microsoft.public.vc.atl - Web Programming Newsgroups IE's DOM interfaces, > ROOT > NEWSGROUP > Microsoft News > microsoft.public.vc.atl, Date: 2/9/2008 4:44:40 AM, Replies: ... converting the nvarchar to ntext. ...
SQL Server Forums - Converting from nvarchar(4000) to ntext When I attempt to do the conversion I get warned about possibly losing information. ... Thank you very much for your help Kristen! I've learnt a lot whilst ...
Conversion failed when converting the nvarchar value - MSDN Forums ... SQL " Conversion failed when converting the nvarchar value ... Any help is much appreciated. Instead concatenating it to the string, pass it as a parameter ...
converting from nvarchar to money datatype ADO error: Cannot convert a char value to money. The char value has. incorrect syntax. ... ntext and update/insert triggers. Need help with SELECT statement please. ...
BlueDragon Self-Help: FAQ nvarchar. ntext. If you wish to store unicode data in your database, be certain that the column ... charset then you'll need to convert the String that was ...
Error converting data type nvarchar to datetime. - Configure It! ( How ... ... a parameter and a CONVERT or CAST is not ... Spec_SelectCheckboxFeature ntext, @Image image, @ImageContentType nvarchar(50) ... Thank you for your help. ...
need help with ntext search W/O full-text capability ... tried to cast the description as type varchar or nvarchar and still ... select topicid from topic where convert(nvarchar(4000),description) like 'searchterm' ...



 
All Times Are GMT