-
Re: For Aurthur.....Inserting values from a text box into a database with SQL
Thanks much for the reply Author, but I've tried that and I get a message
"required parameter missing" I've acutally got several fields that I want
to insert data into, but I started working with just one until I got it fixed.
If I try and insert data into several by hard coding the value in, i.e.
no variable values, then everything goes into the right field except the
first value..that field remains blank..and no error message appears....I'm
at a loss and can't find anything in my books
ex.
conn.execute "Insert into Personal(Name, age, birth) Values('john', 25, 12/15/57)",
1
I only see the age and birth values in the database when I query it through
another program...the name field is blank..?????
thanks again
"Arthur Wood" <wooda@nospam.com> wrote:
>
>Blake,
> Your Execute should look like this:
>
>conn.execute "Insert into Personal(Name) Values(" & txtOne.text & "),1"
>
>
>note that the VALUE of txtOne.Text must be concatenated into the command.
>
>Arthur Wood
>
>"blake" <polychemist@yahoo.com> wrote:
>>
>>I can't seem to take the info typed into a text box and use it in my ADO
>execute
>>SQL statement to insert it into the appropriate fields. Does anyone know
>>how to accomplish this? I'm sure its easy, but it escapes me right now
and
>>is really holding up my app.....thanks very much
>>
>>for example......
>>I've got a text box named txtOne
>>After declaring my connection object and the connection string and opening
>>the object...I try a conn.execute "Insert into Personal(Name) Values(txtOne.text),
>>1"
>>I get an error stating that a required parameter is missing...if I change
>>txtONe.text to something like 'Blake'..it inserts it into the table no
problem...how
>>do I get the value of txtOne into the table????
>
-
Re: For Aurthur.....Inserting values from a text box into a database with SQL
Blake, then try this:
conn.execute "Insert into Personal(Name) Values(" & chr$(34) & txtOne.text
& chr$(34)& "),1"
where a Chr$(34) is a Double-Quote (")
Arthur Wood
"blake" <polychemist@yahoo.com> wrote:
>
>Thanks much for the reply Author, but I've tried that and I get a message
>"required parameter missing" I've acutally got several fields that I want
>to insert data into, but I started working with just one until I got it
fixed.
> If I try and insert data into several by hard coding the value in, i.e.
>no variable values, then everything goes into the right field except the
>first value..that field remains blank..and no error message appears....I'm
>at a loss and can't find anything in my books
>
>ex.
>conn.execute "Insert into Personal(Name, age, birth) Values('john', 25,
12/15/57)",
>1
>
>I only see the age and birth values in the database when I query it through
>another program...the name field is blank..?????
>
>
>thanks again
>
>
>
>"Arthur Wood" <wooda@nospam.com> wrote:
>>
>>Blake,
>> Your Execute should look like this:
>>
>>conn.execute "Insert into Personal(Name) Values(" & txtOne.text & "),1"
>>
>>
>>note that the VALUE of txtOne.Text must be concatenated into the command.
>>
>>Arthur Wood
>>
>>"blake" <polychemist@yahoo.com> wrote:
>>>
>>>I can't seem to take the info typed into a text box and use it in my ADO
>>execute
>>>SQL statement to insert it into the appropriate fields. Does anyone know
>>>how to accomplish this? I'm sure its easy, but it escapes me right now
>and
>>>is really holding up my app.....thanks very much
>>>
>>>for example......
>>>I've got a text box named txtOne
>>>After declaring my connection object and the connection string and opening
>>>the object...I try a conn.execute "Insert into Personal(Name) Values(txtOne.text),
>>>1"
>>>I get an error stating that a required parameter is missing...if I change
>>>txtONe.text to something like 'Blake'..it inserts it into the table no
>problem...how
>>>do I get the value of txtOne into the table????
>>
>
-
Re: For Aurthur.....Inserting values from a text box into a database with SQL
You need to put single quotes around it like this:
conn.execute "Insert into Personal(Name) Values('" & txtOne.text & "'),1"
I'm not sure why your name field is ending up blank when you hard code the
values but one possiblilty is that I think Name is a reserved word and that
may be causing problems. If you can't change the column name in the table
to something else then you should put brackets around Name like this:
conn.execute "Insert into Personal([Name]) Values('" & txtOne.text & "'),1"
I have a question, are you birth values showing up right when you query
after adding a record? You didn't say what database program you are using,
but I think most need the date surrounded by something. I know in Access
it's #'s and MS SQL Server it is single quotes.
Sue
"blake" <polychemist@yahoo.com> wrote in message
news:3c747edd$1@10.1.10.29...
>
> Thanks much for the reply Author, but I've tried that and I get a message
> "required parameter missing" I've acutally got several fields that I want
> to insert data into, but I started working with just one until I got it
fixed.
> If I try and insert data into several by hard coding the value in, i.e.
> no variable values, then everything goes into the right field except the
> first value..that field remains blank..and no error message appears....I'm
> at a loss and can't find anything in my books
>
> ex.
> conn.execute "Insert into Personal(Name, age, birth) Values('john', 25,
12/15/57)",
> 1
>
> I only see the age and birth values in the database when I query it
through
> another program...the name field is blank..?????
>
>
> thanks again
>
>
>
> "Arthur Wood" <wooda@nospam.com> wrote:
> >
> >Blake,
> > Your Execute should look like this:
> >
> >conn.execute "Insert into Personal(Name) Values(" & txtOne.text & "),1"
> >
> >
> >note that the VALUE of txtOne.Text must be concatenated into the command.
> >
> >Arthur Wood
> >
> >"blake" <polychemist@yahoo.com> wrote:
> >>
> >>I can't seem to take the info typed into a text box and use it in my ADO
> >execute
> >>SQL statement to insert it into the appropriate fields. Does anyone
know
> >>how to accomplish this? I'm sure its easy, but it escapes me right now
> and
> >>is really holding up my app.....thanks very much
> >>
> >>for example......
> >>I've got a text box named txtOne
> >>After declaring my connection object and the connection string and
opening
> >>the object...I try a conn.execute "Insert into Personal(Name)
Values(txtOne.text),
> >>1"
> >>I get an error stating that a required parameter is missing...if I
change
> >>txtONe.text to something like 'Blake'..it inserts it into the table no
> problem...how
> >>do I get the value of txtOne into the table????
> >
>
-
Re: For Aurthur.....Inserting values from a text box into a database with SQL
Thanks Sue,
I wasn't sure about singe vs double-quotes, as I rarely use the Execute
method to insert records in the manner that BLake is using. And since his
attempt to hard-cdeo with single quotes seemed to fail, I guessed that it
might reqire double quotes. And you note about the use of Name as a Field-name
in the table is most likely correct.
Blake, it is ALMOST never a good idea to use RESERVED-words (such as Name,
Date, Field, Count etc) as field names in your tables. You should use 'names'
like BuildingName, or EmployerName, or FirstName, or BirthDate, or HireDate,
etc to avoid possible conflicts with reserved words.
Arthur Wood
"Sue Harsevoort" <SusannaH67@hotmail.com> wrote:
>You need to put single quotes around it like this:
>
>conn.execute "Insert into Personal(Name) Values('" & txtOne.text & "'),1"
>
>I'm not sure why your name field is ending up blank when you hard code the
>values but one possiblilty is that I think Name is a reserved word and that
>may be causing problems. If you can't change the column name in the table
>to something else then you should put brackets around Name like this:
>
>conn.execute "Insert into Personal([Name]) Values('" & txtOne.text & "'),1"
>
>I have a question, are you birth values showing up right when you query
>after adding a record? You didn't say what database program you are using,
>but I think most need the date surrounded by something. I know in Access
>it's #'s and MS SQL Server it is single quotes.
>
>Sue
>
>"blake" <polychemist@yahoo.com> wrote in message
>news:3c747edd$1@10.1.10.29...
>>
>> Thanks much for the reply Author, but I've tried that and I get a message
>> "required parameter missing" I've acutally got several fields that I want
>> to insert data into, but I started working with just one until I got it
>fixed.
>> If I try and insert data into several by hard coding the value in, i.e.
>> no variable values, then everything goes into the right field except the
>> first value..that field remains blank..and no error message appears....I'm
>> at a loss and can't find anything in my books
>>
>> ex.
>> conn.execute "Insert into Personal(Name, age, birth) Values('john', 25,
>12/15/57)",
>> 1
>>
>> I only see the age and birth values in the database when I query it
>through
>> another program...the name field is blank..?????
>>
>>
>> thanks again
>>
>>
>>
>> "Arthur Wood" <wooda@nospam.com> wrote:
>> >
>> >Blake,
>> > Your Execute should look like this:
>> >
>> >conn.execute "Insert into Personal(Name) Values(" & txtOne.text & "),1"
>> >
>> >
>> >note that the VALUE of txtOne.Text must be concatenated into the command.
>> >
>> >Arthur Wood
>> >
>> >"blake" <polychemist@yahoo.com> wrote:
>> >>
>> >>I can't seem to take the info typed into a text box and use it in my
ADO
>> >execute
>> >>SQL statement to insert it into the appropriate fields. Does anyone
>know
>> >>how to accomplish this? I'm sure its easy, but it escapes me right now
>> and
>> >>is really holding up my app.....thanks very much
>> >>
>> >>for example......
>> >>I've got a text box named txtOne
>> >>After declaring my connection object and the connection string and
>opening
>> >>the object...I try a conn.execute "Insert into Personal(Name)
>Values(txtOne.text),
>> >>1"
>> >>I get an error stating that a required parameter is missing...if I
>change
>> >>txtONe.text to something like 'Blake'..it inserts it into the table
no
>> problem...how
>> >>do I get the value of txtOne into the table????
>> >
>>
>
>
-
Re: For Aurthur.....Inserting values from a text box into a database with SQL
I don't do many queries through VB code, but I know that in Access I can use
single quotes or double quotes without any problem, but in MS SQL Server
2000 and MS Query only single quotes work, do to be on the safe side I said
single quotes. Of course there could be a database program out there that I
haven't used that will only work with double quotes.
Sue
"Arthur Wood" <wooda@nospam.com> wrote in message
news:3c752b56$1@10.1.10.29...
>
> Thanks Sue,
> I wasn't sure about singe vs double-quotes, as I rarely use the Execute
> method to insert records in the manner that BLake is using. And since his
> attempt to hard-cdeo with single quotes seemed to fail, I guessed that it
> might reqire double quotes. And you note about the use of Name as a
Field-name
> in the table is most likely correct.
>
> Blake, it is ALMOST never a good idea to use RESERVED-words (such as Name,
> Date, Field, Count etc) as field names in your tables. You should use
'names'
> like BuildingName, or EmployerName, or FirstName, or BirthDate, or
HireDate,
> etc to avoid possible conflicts with reserved words.
>
> Arthur Wood
>
>
> "Sue Harsevoort" <SusannaH67@hotmail.com> wrote:
> >You need to put single quotes around it like this:
> >
> >conn.execute "Insert into Personal(Name) Values('" & txtOne.text & "'),1"
> >
> >I'm not sure why your name field is ending up blank when you hard code
the
> >values but one possiblilty is that I think Name is a reserved word and
that
> >may be causing problems. If you can't change the column name in the
table
> >to something else then you should put brackets around Name like this:
> >
> >conn.execute "Insert into Personal([Name]) Values('" & txtOne.text &
"'),1"
> >
> >I have a question, are you birth values showing up right when you query
> >after adding a record? You didn't say what database program you are
using,
> >but I think most need the date surrounded by something. I know in Access
> >it's #'s and MS SQL Server it is single quotes.
> >
> >Sue
> >
> >"blake" <polychemist@yahoo.com> wrote in message
> >news:3c747edd$1@10.1.10.29...
> >>
> >> Thanks much for the reply Author, but I've tried that and I get a
message
> >> "required parameter missing" I've acutally got several fields that I
want
> >> to insert data into, but I started working with just one until I got it
> >fixed.
> >> If I try and insert data into several by hard coding the value in,
i.e.
> >> no variable values, then everything goes into the right field except
the
> >> first value..that field remains blank..and no error message
appears....I'm
> >> at a loss and can't find anything in my books
> >>
> >> ex.
> >> conn.execute "Insert into Personal(Name, age, birth) Values('john', 25,
> >12/15/57)",
> >> 1
> >>
> >> I only see the age and birth values in the database when I query it
> >through
> >> another program...the name field is blank..?????
> >>
> >>
> >> thanks again
> >>
> >>
> >>
> >> "Arthur Wood" <wooda@nospam.com> wrote:
> >> >
> >> >Blake,
> >> > Your Execute should look like this:
> >> >
> >> >conn.execute "Insert into Personal(Name) Values(" & txtOne.text &
"),1"
> >> >
> >> >
> >> >note that the VALUE of txtOne.Text must be concatenated into the
command.
> >> >
> >> >Arthur Wood
> >> >
> >> >"blake" <polychemist@yahoo.com> wrote:
> >> >>
> >> >>I can't seem to take the info typed into a text box and use it in my
> ADO
> >> >execute
> >> >>SQL statement to insert it into the appropriate fields. Does anyone
> >know
> >> >>how to accomplish this? I'm sure its easy, but it escapes me right
now
> >> and
> >> >>is really holding up my app.....thanks very much
> >> >>
> >> >>for example......
> >> >>I've got a text box named txtOne
> >> >>After declaring my connection object and the connection string and
> >opening
> >> >>the object...I try a conn.execute "Insert into Personal(Name)
> >Values(txtOne.text),
> >> >>1"
> >> >>I get an error stating that a required parameter is missing...if I
> >change
> >> >>txtONe.text to something like 'Blake'..it inserts it into the table
> no
> >> problem...how
> >> >>do I get the value of txtOne into the table????
> >> >
> >>
> >
> >
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|