473,388 Members | 1,286 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

insert a textbox value into access

hi, i'm trying to insert a textbox value into a access database. i get
an error: 'Error: no value given for one or more required parameters.'
nothing is set to be required in the db. is there something wrong
with my syntax?
Dim formConn As OleDb.OleDbConnection = New OleDb.OleDbConnection
Try
formConn.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\CustomerInfo.mdb;"
formConn.Open()
Dim formCommand As New OleDb.OleDbCommand("Insert into
CustomerInformation (FirstName) Values (" & Me.txtFname.Text & ")",
formConn)
formCommand.ExecuteNonQuery()
Catch ex As Exception
MsgBox("Error: " & ex.Message)
Finally
If formConn.State <> ConnectionState.Closed Then
formConn.Close()
End If
End Try

Jun 13 '06 #1
4 4771
For starters, you need a single quote before and after the value you get
from me.txtFname.text.

Next, you probably shouldn't be useing me.txtFname.text. That is the value
currently being entered in a text box, before the text box is update. You
probably want .value instead.

Mainly, though, you seem to be trying to insert a new record after
populating only one field, FirstName. Is that really your intention?
Jun 13 '06 #2
no it's not my intention, but before i type every field out i wanted to
make sure it would work. also, when i use single quotes the FirstName
value in the db is & txtFname.value. not what is typed into the
textbox.

Jun 13 '06 #3
"Insert into CustomerInformation (FirstName) Values ('" & Me.txtFname.Text &
"')"

Single quotes go between the left paren and the double quote, and between
the double quote and the right paren. You want your sql to evaluate to
this:

Insert into CustomerInformation (FirstName) Values ('WhateverITyped')

If you're supplying text, you have to delimit it.
Jun 13 '06 #4
ok, i see. thanks for the clarification. that worked nicely. let me
add the rest of the fields now. thanks a bunch.

Jun 13 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Abareblue | last post by:
I have no clue on how to insert a record into access. here is the whole thing using System; using System.Drawing; using System.Collections; using System.ComponentModel;
10
by: Ricardo | last post by:
How can I make a insert sql string to insert direct in a table(not a dataset) using the textbox.text propert??
11
by: anony | last post by:
Hello, I can't figure out why my parameterized query from an ASP.NET page is dropping "special" characters such as accented quotes & apostrophes, the registered trademark symbol, etc. These...
7
by: Arek | last post by:
Hey, I am inserting values in the table: Dim sqlcomm1 As SqlCommand = New SqlCommand("INSERT INTO tblTasks (idTask, outdate) VALUES ('" & IDTask.text & "','" & txtOutdate.Text & "')", conn)...
3
by: Neil Zanella | last post by:
Hello, I am trying to execute ADO.NET INSERT statement where one of the fields is coming from a password HTML control. When I access the text with password.Value and print with Response.Write...
2
by: Rich | last post by:
Hello, I have an oleDBDataAdapter (da1) which gets data from an Access mdb and fills a dataset (ds1) with integer data from "tbl1" in Access. Data displays in textboxes on a form. The...
1
by: reagen | last post by:
dear all, please help me that my script cannot insert data to ms acces. <%@ Page Language="vb" ContentType="text/html"%> <%@ Import NameSpace = "System.Data" %> <%@ Import NameSpace =...
2
by: rn5a | last post by:
In a ASP applicatiuon, the FOrm has a textbox & a select list where the admin can select multiple options. Basically the admin has to enter the name of a new coach in the textbox & select the...
0
by: troydixon | last post by:
Hello, I am new at this, and have been trying to insert data into a table by using the footer of a gridview (which I dont like) or by using a detials view on the same page that is doing the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.