Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 6th, 2006, 05:13 AM
Authorized User
 
Join Date: Jun 2006
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default Converting Problem

Hi All

I have done one function in asp.net.
        Ival.Insert(1, New DBValues("Diagnosis", Diagnosis, mod_commonFunctions.DataType.DString))
Ival is my arraylist.


  For i = 0 To IValues.Count - 1
            nvalues = IValues(i) 'the value of ith index is assgning to nvalues(here value is form of DBvalue'
            ParamList = ParamList & ", @" & nvalues.ColumnName
            ColumnList = ColumnList & "," & nvalues.ColumnName
        Next

        ParamList = Trim(Mid(ParamList, 2))
        ColumnList = Trim(Mid(ColumnList, 2))
        sqlcmd.CommandText = "INSERT INTO " & Tablename & " (" & ColumnList & ") VALUES (" & ParamList & ")"
        sqlcmd.Transaction = Tran
        With sqlcmd.Parameters
            For i = 0 To IValues.Count - 1
                Dim pParam As New SqlParameter
                nvalues = IValues(i)
                pParam.ParameterName = "@" & nvalues.ColumnName
                pParam.Value = nvalues.ColumnValue
                .Add(pParam)
            Next
        End With
        sqlcmd.ExecuteNonQuery()

When i reach executenonquery,then i got error:"Error converting datatype nvarchar to numeric"

I am not understand How to solve this error?If u have soln pls solve it and give me ans.

Thanks
monika

 
Old November 6th, 2006, 10:35 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

You are passing a string into your SQL Query where a numeric value is expected. Verifiy your sql query.

-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem converting string to Date. akhilhp ASP.NET 2.0 Basics 2 July 6th, 2008 08:02 AM
converting and sending data problem csharpa ADO.NET 2 March 24th, 2007 06:38 AM
Problem Converting 1.1 to 2.0 Ron Howerton ASP.NET 2.0 Basics 8 March 23rd, 2006 11:53 AM
problem while converting xml to html its_vippy XSLT 2 May 30th, 2005 09:13 PM
Problem converting type gylim78 VB.NET 2002/2003 Basics 5 April 8th, 2004 04:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.