Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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 June 25th, 2007, 07:16 AM
Registered User
 
Join Date: Jun 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Object must implement IConvertible.

I have a form that insert data into database. i am using oracle. Please tell me where i am wrong.I am getting the following error message.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Object must implement IConvertible.

Source Error:


Line 214: 'mycmd.Connection.Open()
Line 215:
Line 216: mycmd.ExecuteNonQuery()
Line 217:
Line 218: ' Try

here is code
  Dim mycmd As OracleCommand
        Dim inscmd As String
        Dim str2 As String

        str2 = "user id= nfc; password=nfc; data source = dh"
        mycon = New OracleConnection(str2)
        mycon.Open()


        Dim c As String = (ccode.Text)
        Dim where As String
        where = "DDL0201081" & c

        inscmd = "INSERT INTO CUSTOMER_MASTER(CUSTOMER_COMPANY_CODE, CUSTOMER_CODE," _
         & "CUSTOMER_NAME, CUSTOMER_SHORT_NAME, CUSTOMER_ADDRESS1, CUSTOMER_ADDRESS2," _
         & "CUSTOMER_ADDRESS3, CUSTOMER_PHONE, CUSTOMER_TELEX," _
 & "CUSTOMER_FAX, CUSTOMER_EMAIL_ID, CUSTOMER_WEB_SITE,CUSTOMER_TYPE," _
  & " CUSTOMER_MESSAGE, CUSTOMER_CONTACT_NAME," _
& " CUSTOMER_TRAVEL_AGENT, VENDOR_TYPE, CUSTOMER_LOCATION_CODE," _
& " CUSTOMER_GL, WHERENAME, CUSTOMER_CATEGORY, CUSTOMER_RATE_PLAN," _
 & "CUSTOMER_PIN_CD)" _
 & "values(@CUSTOMER_COMPANY_CODE,@CUSTOMER_CODE, @CUSTOMER_NAME, @CUSTOMER_SHORT_NAME, @CUSTOMER_ADDRESS1, @CUSTOMER_ADDRESS2, @CUSTOMER_ADDRESS3," _
& "@CUSTOMER_PHONE, @CUSTOMER_TELEX, @CUSTOMER_FAX, @CUSTOMER_EMAIL_ID, @CUSTOMER_WEB_SITE, @CUSTOMER_TYPE," _
 & " @CUSTOMER_MESSAGE, @CUSTOMER_CONTACT_NAME," _
 & " @CUSTOMER_TRAVEL_AGENT, @VENDOR_TYPE, @CUSTOMER_LOCATION_CODE," _
 & "@CUSTOMER_GL, @WHERENAME, @CUSTOMER_CATEGORY, @CUSTOMER_RATE_PLAN," _
 & "@CUSTOMER_PIN_CD)"

        mycmd = New OracleCommand(inscmd, mycon)

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_COMPANY_CODE", OracleType.VarChar, 2))
        mycmd.Parameters("@CUSTOMER_COMPANY_CODE").Value = "DD"

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_CODE", OracleType.VarChar, 9))
        mycmd.Parameters("@CUSTOMER_CODE").Value = ccode.Text

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_NAME", OracleType.VarChar, 150))
        mycmd.Parameters("@CUSTOMER_NAME").Value = cname.Text


        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_SHORT_NAME", OracleType.VarChar, 40))
        mycmd.Parameters("@CUSTOMER_SHORT_NAME").Value = sname.SelectedItem

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_ADDRESS1", OracleType.VarChar, 40))
        mycmd.Parameters("@CUSTOMER_ADDRESS1").Value = address.Text

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_ADDRESS2", OracleType.VarChar, 40))
        mycmd.Parameters("@CUSTOMER_ADDRESS2").Value = "add2"

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_ADDRESS3", OracleType.VarChar, 40))
        mycmd.Parameters("@CUSTOMER_ADDRESS3").Value = city.Text

        'mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_PAYMENT_LIMIT", OracleType.Number, 14))
        'mycmd.Parameters("@CUSTOMER_PAYMENT_LIMIT").Value = " "

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_PHONE", OracleType.VarChar, 30))
        mycmd.Parameters("@CUSTOMER_PHONE").Value = phone.Text

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_TELEX", OracleType.VarChar, 30))
        mycmd.Parameters("@CUSTOMER_TELEX").Value = pcard.Text

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_FAX", OracleType.VarChar, 30))
        mycmd.Parameters("@CUSTOMER_FAX").Value = fax.Text

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_EMAIL_ID", OracleType.VarChar, 30))
        mycmd.Parameters("@CUSTOMER_EMAIL_ID").Value = email.Text

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_WEB_SITE", OracleType.VarChar, 30))
        mycmd.Parameters("@CUSTOMER_WEB_SITE").Value = wsite.Text

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_TYPE", OracleType.VarChar, 3))
        mycmd.Parameters("@CUSTOMER_TYPE").Value = "O01"

        'mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_LST_NUMBER", OracleType.VarChar, 30))
        'mycmd.Parameters("@CUSTOMER_LST_NUMBER").Value = " "

        'mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_CST_NUMBER", OracleType.VarChar, 30))
        'mycmd.Parameters("@CUSTOMER_CST_NUMBER").Value = " "

        'mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_CR_LIMIT", OracleType.Number, 14))
        'mycmd.Parameters("@CUSTOMER_CR_LIMIT").Value = " "

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_MESSAGE", OracleType.VarChar, 100))
        mycmd.Parameters("@CUSTOMER_MESSAGE").Value = msg.Text

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_CONTACT_NAME", OracleType.VarChar, 31))
        mycmd.Parameters("@CUSTOMER_CONTACT_NAME").Value = conname.Text

        'mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_TOTAL_DB", OracleType.Number, 14))
        'mycmd.Parameters("@CUSTOMER_TOTAL_DB").Value = " "


        'mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_TOTAL_CR", OracleType.Number, 14))
        'mycmd.Parameters("@CUSTOMER_TOTAL_CR").Value = " "

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_TRAVEL_AGENT", OracleType.VarChar, 1))
        mycmd.Parameters("@CUSTOMER_TRAVEL_AGENT").Value = "N"

        mycmd.Parameters.Add(New OracleParameter("@VENDOR_TYPE", OracleType.VarChar, 50))
        mycmd.Parameters("@VENDOR_TYPE").Value = vtype.Text

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_LOCATION_CODE", OracleType.VarChar, 6))
        mycmd.Parameters("@CUSTOMER_LOCATION_CODE").Value = "L020"

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_GL", OracleType.VarChar, 6))
        mycmd.Parameters("@CUSTOMER_GL").Value = "1081"

        mycmd.Parameters.Add(New OracleParameter("@WHERENAME", OracleType.VarChar, 60))
        mycmd.Parameters("@WHERENAME").Value = where

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_CATEGORY", OracleType.VarChar, 1))
        mycmd.Parameters("@CUSTOMER_CATEGORY").Value = "O"

        'mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_BILLABLE", OracleType.VarChar, 1))
        'mycmd.Parameters("@CUSTOMER_BILLABLE").Value = " "


        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_RATE_PLAN", OracleType.VarChar, 4))
        mycmd.Parameters("@CUSTOMER_RATE_PLAN").Value = rplan.SelectedValue


        'mycmd.Parameters.Add(New OracleParameter("@RATE_EFFDT_FR", OracleType.DateTime))
        'mycmd.Parameters("@RATE_EFFDT_FR").Value = txtfrom.Text

        'mycmd.Parameters.Add(New OracleParameter("@RATE_EFFDT_TO", OracleType.DateTime))
        'mycmd.Parameters("@RATE_EFFDT_TO").Value = txtto.Text

        'mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_JOIN_DATE", OracleType.DateTime))
        'mycmd.Parameters("@CUSTOMER_JOIN_DATE").Value = txtfrom.Text

        'mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_BIRTH_DATE", OracleType.DateTime))
        'mycmd.Parameters("@CUSTOMER_BIRTH_DATE").Value = dob.Text


        'mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_MARRAIGE_ANNIV", OracleType.DateTime))
        'mycmd.Parameters("@CUSTOMER_MARRAIGE_ANNIV").Valu e = marriage.Text

        mycmd.Parameters.Add(New OracleParameter("@CUSTOMER_PIN_CD", OracleType.Number, 6))
        mycmd.Parameters("@CUSTOMER_PIN_CD").Value = pincode.Text
        'mycmd.Connection.Open()

        mycmd.ExecuteNonQuery()

        ' Try
        ' mycmd.ExecuteNonQuery()

        'Message.InnerHtml = "<b>Record Added</b><br>" & inscmd

        'Catch ex As Exception

        'Message.InnerHtml = "ERROR: Could not add record"

        'Message.Style("color") = "red"

        'End Try








Similar Threads
Thread Thread Starter Forum Replies Last Post
Object must implement IConvertible. inspiron ASP.NET 1.0 and 1.1 Basics 6 December 15th, 2006 07:40 PM
Object must implement IConvertable furqanms C# 0 December 1st, 2006 03:08 AM
IConvertible Error hoailing22 ASP.NET 1.0 and 1.1 Basics 5 March 16th, 2006 12:18 AM
IConvertible error problem geek.net ADO.NET 1 February 14th, 2006 06:44 PM
Stored procedure IConvertible nk15 SQL Server ASP 1 November 1st, 2004 03:22 PM





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