Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > adding data...got problem....pls help

Reply
Thread Tools

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

 
 
zheetee@gmail.com
Guest
Posts: n/a
 
      04-23-2006
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???

 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      04-23-2006
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




"(E-Mail Removed)" 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???
>
>

 
Reply With Quote
 
 
 
 
Jeff Dillon
Guest
Posts: n/a
 
      05-17-2006
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 & "')"

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
>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???
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Help Help Pentax S5i Help needed (Please) The Martian Digital Photography 14 06-20-2008 07:56 AM
Need help adding a chart in VB.NET =?Utf-8?B?UGF0cmljaw==?= ASP .Net 2 04-18-2008 07:55 AM
Need help adding computer to network =?Utf-8?B?TG91aWU=?= Wireless Networking 5 07-16-2005 02:45 PM
dataset help, adding a column inside a loop dSchwartz ASP .Net 2 03-01-2004 07:44 PM
Help adding X-No-Archive: Yes header :: brian :: Firefox 3 10-13-2003 06:16 PM



Advertisments