hi
Im doing one small project.For that i want the correct format of codings to
Insert into the table qury.So kindly anyone help me to insert the data into
the databae.
8 4476
hi
Im doing one small project.For that i want the correct format of codings to
Insert into the table qury.So kindly anyone help me to insert the data into
the databae.
Hi, do you happen to have written any code for this? If you have would you please post it here thanks.
hi
The doubt you have asked here is not clear any how i can give you a general query first declair a conection later an adapter and a command statement and in
that write this query
insert into userdetails (name,age,gender) values ('seshu',23,'male')
in the above statement tablename is userdetails
column1 name is name
column2 name is age
column3 name is gender
hi willakawill
i have written the code is
connection.Execute"insert into table(date,time)values(' " & label1.caption & " ' , ' " & label2.caption & " ')"
But the run time error occured as Syntax error in insert into statement.
so you send me the correct format of code.
thanks
Hi, do you happen to have written any code for this? If you have would you please post it here thanks.
hi willakawill
i have written the code is
connection.Execute"insert into table(date,time)values(' " & label1.caption & " ' , ' " & label2.caption & " ')"
But the run time error occured as Syntax error in insert into statement.
so you send me the correct format of code.
thanks
Hi, i asume you are uding vb6,
fist of all you need a recordset, then use it to make any sql query
code
dim cn as adodn.connection
Dim rs1 as adobd.recordset
set cn = new adodb.connection
cn.open "Provider=SQLOLEDB;Persist Security Info=False;User ID=" & user id & _
";Password=" &(Password& ";Initial Catalog=" & Database & ";Data Source=" & SQl
set rs1 = new adodb.recordset
rs1.open "Insert into (yourtablename) ("columns") Values("Data"), cn
hi willakawill
i have written the code is
connection.Execute"insert into table(date,time)values(' " & label1.caption & " ' , ' " & label2.caption & " ')"
But the run time error occured as Syntax error in insert into statement.
so you send me the correct format of code.
thanks
Great. Please ignore the other posts. The information in them is incorrect. Your code looks good. Please tell me what the data type of the (date, time) fields are.
Great. Please ignore the other posts. The information in them is incorrect. Your code looks good. Please tell me what the data type of the (date, time) fields are.
It would probably also help if you set a breakpoint at this line (or just go into debug mode when it hits the error, I suppose) and print the actual final value of the string which is being passed to the Execute method.
If you're not sure how to do that, I'd suggest you just copy the entire statement to the clipboard, starting with the quotes after the word Execute. Then go to the immediate window, type Print, then paste in what you copied. When you hit enter, it should print out the complete string including the concatenated values. Then you can copy and paste that into a reply here so we can see what we're dealing with.
Oh, and a little tip - it's probably not a good idea to name your fields date or time, as these are reserved words which may be misinterpreted in some circumstances.
Great. Please ignore the other posts. The information in them is incorrect. Your code looks good. Please tell me what the data type of the (date, time) fields are.
hi willakawill
The datatype of the (date,time) fields are date/time.
Im using the back end is MS Access in VB6.
So kindly reply me.
hi willakawill
The datatype of the (date,time) fields are date/time.
Im using the back end is MS Access in VB6.
So kindly reply me.
OK that is what I thought. You need to use the # sign when writing a query with date/time fields. - connection.Execute"insert into table(date,time)values(#" & label1.caption & " # , #" & label2.caption & "#)"
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Philip Boonzaaier |
last post by:
I want to be able to generate SQL statements that will go through a list of
data, effectively row by row, enquire on the database if this exists in the
selected table- If it exists, then the colums must be UPDATED, if not, they
must be INSERTED.
Logically then, I would like to SELECT * FROM <TABLE>
WHERE ....<Values entered here>, and then...
|
by: Carl |
last post by:
Hi,
I hope someone can share some of their professional advice and help me out
with my embarissing problem concerning an Access INSERT query. I have never
attempted to create a table with one-to-one relationship but on this
occasion
I must keep username/password details within a seperate table.
Here's the basic specs and database schema:...
|
by: authorking |
last post by:
I use the following code to insert a data record in to a datatable of an
access database.But every time I execute the command, there will rise an
exception and the insert operation can't be completed.
here's the code:
System.Data.OleDb.OleDbConnection hist_cnn = new
System.Data.OleDb.OleDbConnection();
System.Data.OleDb.OleDbCommand ...
|
by: kosta |
last post by:
hello! one of my forms communicates with a database, and is
supposed to add a row to a table using an Insert
statement... however, I get a 'oledb - syntax error'
exception... I have double checked, and the insert works
fine (tried to use it from access)... im using visual C#
express 2k5... what could be wrong? thanks!
|
by: Shapper |
last post by:
Hello,
I have created 3 functions to insert, update and delete an Access
database record. The Insert and the Delete code are working fine.
The update is not. I checked and my database has all the necessary
records in it when testing it. I get the error "No value given for one
or more required parameters." when I try to update the...
| |
by: David Bear |
last post by:
I have a dictionary that contains a row of data intended for a data base.
The dictionary keys are the field names. The values are the values to be
inserted.
I am looking for a good pythonic way of expressing this, but I have a
problem with the way lists are represented when converted to strings.
Lets say my dictionary is
|
by: Bonzol |
last post by:
Hello, PHP n00b here.
Using SQL just working off some examples, I have no problem selecting
data, but I cant seem to be able to insert. If someone could see where
im going wrong
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html...
|
by: Ben |
last post by:
I don't know whether anyone can help, but I have an odd problem. I have
a PSP (Spyce) script that makes many calls to populate a database. They
all work without any problem except for one statement.
I first connect to the database...
self.con = MySQLdb.connect(user=username, passwd =password)
self.cursor = self.con.cursor()...
|
by: radiodes |
last post by:
I am very new to SQL/Access, and only use it very limitedly, so
apologies
ahead of time.
I have a website that inserts data into an access database, using the
code
below. Basically, I've got one INSERT INTO statement that inserts
one
line of data into one database, and and then a php for loop that
inserts multiple lines into a database...
|
by: =?Utf-8?B?RXJpYyBGYWxza2Vu?= |
last post by:
We’re storing our main entity in an insert only table which stores the
history of past revisions, but we’re facing problems with storing this
history as LINQ will only update the entity, and not reinsert it with a
different revision number.
Compounding the issue, we’ve also got an associated table storing properties
for our entities...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |