adding data...got problem....pls help

Discussion in 'ASP .Net' started by zheetee@gmail.com, Apr 23, 2006.

  1. Guest

    i am beginner to link asp.net and access 2gether
    i use asp .net matrix...and wrote the Insert data coding

    Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole
    DB Services=-4; Data Source=C:\Documents an"& _
    "d Settings\AliceLee\My Documents\db\equipment.mdb"
    Dim dbConnection As System.Data.IDbConnection = New
    System.Data.OleDb.OleDbConnection(connectionString)

    Dim queryString As String = "INSERT INTO [test]
    ([SerialNumber]) VALUES (SerialNumber1)"
    Dim dbCommand As System.Data.IDbCommand = New
    System.Data.OleDb.OleDbCommand
    dbCommand.CommandText = queryString
    dbCommand.Connection = dbConnection

    Dim rowsAffected As Integer = 0
    dbConnection.Open
    Try
    rowsAffected = dbCommand.ExecuteNonQuery
    Finally
    dbConnection.Close

    End Try

    'Return rowsAffected

    it returned--> Exception Details: System.Data.OleDb.OleDbException: No
    value given for one or more required parameters.

    SerialNumber1 is a textbox that i using in the asp.net page....

    can i know what is the problem???
    why cant get the add the SerialNumber1.text into access???
     
    , Apr 23, 2006
    #1
    1. Advertising

  2. If "SerialNumber1" is a textbox control, then its value should be

    SerialNumber1.Text

    Peter

    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "" wrote:

    > i am beginner to link asp.net and access 2gether
    > i use asp .net matrix...and wrote the Insert data coding
    >
    > Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole
    > DB Services=-4; Data Source=C:\Documents an"& _
    > "d Settings\AliceLee\My Documents\db\equipment.mdb"
    > Dim dbConnection As System.Data.IDbConnection = New
    > System.Data.OleDb.OleDbConnection(connectionString)
    >
    > Dim queryString As String = "INSERT INTO [test]
    > ([SerialNumber]) VALUES (SerialNumber1)"
    > Dim dbCommand As System.Data.IDbCommand = New
    > System.Data.OleDb.OleDbCommand
    > dbCommand.CommandText = queryString
    > dbCommand.Connection = dbConnection
    >
    > Dim rowsAffected As Integer = 0
    > dbConnection.Open
    > Try
    > rowsAffected = dbCommand.ExecuteNonQuery
    > Finally
    > dbConnection.Close
    >
    > End Try
    >
    > 'Return rowsAffected
    >
    > it returned--> Exception Details: System.Data.OleDb.OleDbException: No
    > value given for one or more required parameters.
    >
    > SerialNumber1 is a textbox that i using in the asp.net page....
    >
    > can i know what is the problem???
    > why cant get the add the SerialNumber1.text into access???
    >
    >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Apr 23, 2006
    #2
    1. Advertising

  3. Jeff Dillon Guest

    You need to concatenate your SerialNumber1.Text value into your string.

    Practice on a program that doesn't connect to the database, and learn how to
    build strings.

    Dim queryString As String = "INSERT INTO [test] ([SerialNumber]) VALUES ('"
    & SerialNumber1.Text & "')"

    <> wrote in message
    news:...
    >i am beginner to link asp.net and access 2gether
    > i use asp .net matrix...and wrote the Insert data coding
    >
    > Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole
    > DB Services=-4; Data Source=C:\Documents an"& _
    > "d Settings\AliceLee\My Documents\db\equipment.mdb"
    > Dim dbConnection As System.Data.IDbConnection = New
    > System.Data.OleDb.OleDbConnection(connectionString)
    >
    > Dim queryString As String = "INSERT INTO [test]
    > ([SerialNumber]) VALUES (SerialNumber1)"
    > Dim dbCommand As System.Data.IDbCommand = New
    > System.Data.OleDb.OleDbCommand
    > dbCommand.CommandText = queryString
    > dbCommand.Connection = dbConnection
    >
    > Dim rowsAffected As Integer = 0
    > dbConnection.Open
    > Try
    > rowsAffected = dbCommand.ExecuteNonQuery
    > Finally
    > dbConnection.Close
    >
    > End Try
    >
    > 'Return rowsAffected
    >
    > it returned--> Exception Details: System.Data.OleDb.OleDbException: No
    > value given for one or more required parameters.
    >
    > SerialNumber1 is a textbox that i using in the asp.net page....
    >
    > can i know what is the problem???
    > why cant get the add the SerialNumber1.text into access???
    >
     
    Jeff Dillon, May 17, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VB Programmer
    Replies:
    2
    Views:
    378
    VB Programmer
    Jan 14, 2006
  2. =?Utf-8?B?QmlsbDQ0MDc3?=

    Help Pls - declarative data binding

    =?Utf-8?B?QmlsbDQ0MDc3?=, Jan 27, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    447
    =?Utf-8?B?QmlsbDQ0MDc3?=
    Jan 27, 2006
  3. Pietro Marrone
    Replies:
    11
    Views:
    2,844
    John W. Kennedy
    Apr 17, 2007
  4. Replies:
    0
    Views:
    299
  5. Raghu Raman

    Data grid help pls

    Raghu Raman, Dec 3, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    101
    Michelle Hlaing
    Dec 30, 2004
Loading...

Share This Page