Hi,
I am new to this forum and have been troubled by this problem for the past few days. I would appreciate if someone would take a look and help me out.
I am using vb express 2005 edition... - Dim sql As String = "SELECT * FROM SB_ADWarning"
-
Dim strConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\SB_2000.mdb"
-
Dim Con As New OleDbConnection(strConnString)
-
Dim da As New OleDbDataAdapter(sql, Con)
-
Dim ds As New DataSet()
-
Dim dt As DataTable
-
Dim dsNewRow As DataRow
-
Dim cb As OleDbCommandBuilder = New OleDbCommandBuilder(da)
-
da.Fill(ds, "ADWarning")
-
Con.Close()
-
dt = ds.Tables("ADWarning")
-
Try
-
dsNewRow = dt.NewRow()
-
dsNewRow("IssueDate") = Me.TextBox1.Text
-
dsNewRow("IssueTime") = Me.TextBox2.Text
-
dsNewRow("FcstOnsetTime") = Me.TextBox3.Text
-
dsNewRow("FcstCldAmt") = Me.TextBox4.Text
-
dt.Rows.Add(dsNewRow)
-
Dim drModified As DataRow() = dt.Select(Nothing, Nothing, DataViewRowState.Added)
-
Con.Open()
-
ListBox1.DataSource = ds.Tables("ADWarning")
-
ListBox1.DisplayMember = "IssueDate"
-
da.UpdateCommand = cb.GetInsertCommand
-
da.Update(drModified)
-
MessageBox.Show("Database has been updated!", "Data", MessageBoxButtons.OK, MessageBoxIcon.Information)
-
Catch eInsertException As Exception
-
MsgBox(eInsertException.Message & eInsertException.Source)
-
Throw eInsertException
-
Finally
-
Con.Close()
-
End Try
I get an error prompt when debugging
System.Oledb.Ol edbException: {"Syntax error in INSERT INTO statement."}
error code: -2147217900
error source: Microsoft JET Database Engine
Thank you for your kind attention!
4 5807
Hi,
I am new to this forum and have been troubled by this problem for the past few days. I would appreciate if someone would take a look and help me out.
I am using vb express 2005 edition...
Dim sql As String = "SELECT * FROM SB_ADWarning"
Dim strConnString As String = "Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=C:\SB_20 00.mdb"
Dim Con As New OleDbConnection (strConnString)
Dim da As New OleDbDataAdapte r(sql, Con)
Dim ds As New DataSet()
Dim dt As DataTable
Dim dsNewRow As DataRow
Dim cb As OleDbCommandBui lder = New OleDbCommandBui lder(da)
da.Fill(ds, "ADWarning" )
Con.Close()
dt = ds.Tables("ADWa rning")
Try
dsNewRow = dt.NewRow()
dsNewRow("Issue Date") = Me.TextBox1.Tex t
dsNewRow("Issue Time") = Me.TextBox2.Tex t
dsNewRow("FcstO nsetTime") = Me.TextBox3.Tex t
dsNewRow("FcstC ldAmt") = Me.TextBox4.Tex t
dt.Rows.Add(dsN ewRow)
Dim drModified As DataRow() = dt.Select(Nothi ng, Nothing, DataViewRowStat e.Added)
Con.Open()
ListBox1.DataSo urce = ds.Tables("ADWa rning")
ListBox1.Displa yMember = "IssueDate"
da.UpdateComman d = cb.GetInsertCom mand
da.Update(drMod ified)
MessageBox.Show ("Database has been updated!", "Data", MessageBoxButto ns.OK, MessageBoxIcon. Information)
Catch eInsertExceptio n As Exception
MsgBox(eInsertE xception.Messag e & eInsertExceptio n.Source)
Throw eInsertExceptio n
Finally
Con.Close()
End Try
I get an error prompt when debugging
System.Oledb.Ol edbException: {"Syntax error in INSERT INTO statement."}
error code: -2147217900
error source: Microsoft JET Database Engine
Thank you for your kind attention!
Hi ,
From the error statement it seems that the Insert statement is not formulated correctly at your end inside the program. Carefully look into the insert statement and see if you are missing out anything.
thanks
ansuman
www.mindfiresol utions.com
Hi ,
From the error statement it seems that the Insert statement is not formulated correctly at your end inside the program. Carefully look into the insert statement and see if you are missing out anything.
thanks
ansuman
www.mindfiresol utions.com
Hi,
Thank you for your reply! I am not really sure how to correct the error.. I found that my error statement is: da.Update(drMod ified) when debugging.. Can you please help me to check how to correct this statement. Thank you for your help!
Hi,
Thank you for your reply! I am not really sure how to correct the error.. I found that my error statement is: da.Update(drMod ified) when debugging.. Can you please help me to check how to correct this statement. Thank you for your help!
I'm not that familiar with this area, but would have to guess that the date/time format is to blame. Could you try commenting out the setting of any date and/or time fields, to see what effect it has? Date and times are a very common source of problems when dealing with Access databases.
(It may be necessary to use "#" delimiters around the values, or convert them to an actual Date data type before passing them, or perhaps simply change the format. Feel free to try any of these, but I believe the first step must be to pin down exactly where the error lies before trying to correct it. Hence the commenting.)
I can't really say anything about the connection, as I don't know anything about that area. But some other things that you might check include whether there are required fields for which you have not supplied a value. Or other validation rules in the database which your data doesn't match.
Is there any way we can get a look at the INSERT statement which is being generated? That might answer everything.
Hi,
Just looking to your code; I thought you are storing date and time value in your database. If so, why are you using textbox. Use datetime control. It will solve your problem. One more thing is check the format for date and time. If you wanna save date and time; U must format them as needed by the database settings.
like :
table(0).Fields (0).value = Format(dtpdate. value,"dd-mm-yyyy")
hope this will help you.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Mark Huebner |
last post by:
The following sample code for the lock statement is on page 112 of the
O'Reilly book "C# Essentials". Can somebody explain to me why this
recursive class definition of LockTest does not cause an infinite number of
LockTest objects to be created (i.e., until it consumes all available
memory)? I don't understand why only two threads are created.
using System;
using System.Threading;
|
by: bardo |
last post by:
Hello all,
I have the following problem that I can't seem to solve.
I have a database with 6 different tables. when I update the tables I have
no problems expect with 1 table.
I get a "the instruction Insert contains a syntax error" (I translated this
to english cause I get the error message in dutch).
Using the debugger I can only find the following info
" cannot view the index property " (this not translated).
|
by: Kathy Burke |
last post by:
Ugh. I'm using the following in an asp.net. I get an Syntax Error in
INSERT INTO Statement on line Cmd1.ExecuteNonQuery().
I've made all my database fields text (just to eliminate that as a
potential problem). I changed all my variables in the insert statement
to text to test as shown below. Still getting the error! I've checked
again and again my db table and field names. Could someone please tell
me where to go from here??? THANKS,...
|
by: BaWork |
last post by:
I have the following to insert a new record:
<%
..
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=qqqqq;"
SQLStmt = "INSERT INTO tbl_qqqqqq (main_cat, cat_fee, fee_amount) "
SQLStmt = SQLStmt & "VALUES ('" & main_cat & "','" & cat_fee & "','" &
fee_amount & "')"
|
by: tweety07 |
last post by:
The code is very simple like
try{
aform.submit();
}
catch(e){
alert("error");
}
The application running, then the server is shut down, assumming user doesn't know and try to post a form. The above code doesn't catch any error at all. I'd expect IE gives an error, but it seems go through successfully. Do you have any idea why???
| |
by: DontB3 |
last post by:
Hi, I'm new in this forum, and i hope someone can help.
I'm creating an automatic application that transfer a database from Access -> DBF -> Oracle.
When My App try to execute Insert SQL statement from DBF to Oracle database i found an error like this
{Run-time error "7": Error executing statement! Error: System resource exceeded.}
and then my program crash! i have to close my app, and start again.
could some one help me to...
|
by: Dameon99 |
last post by:
Hi.. Im experiencing a weird error I dont know how to fix. I have a scanner object and whenever I use nextInt, anything above 3 causes the program to crash saying and links me to this line of the class: (one I added all the asteriss to.
// If we are at the end of input then NoSuchElement;
// If there is still input left then InputMismatch
private void throwFor() {
skipped = false;
if ((sourceClosed) &&...
|
by: Baglovely |
last post by:
I want to display a saved picture in a picture box, then delete the file, but i get the error:
"The process cannot access the file "C:\IMAGES\ABCDEF.jpg" because it is being used by another process."
here is the code i'm using.
PicBox.Image = Image.FromFile(C:\IMAGES\ABCDEF.jpg")
PicBox.Image.Dispose()
PicBox.Image = Nothing
File.Delete(C:\IMAGES\ABCDEF.jpg") 'ERROR HERE
|
by: ckreisler |
last post by:
I am trying to write an SQL statement that will inspect one column of a table and return only the first letter of each word in the column.
For intance : The little red hen crossed the road
The reults would be : Tlrhctr.
Don't even ask why this is needed, our customer service department is trying to set up alternate keys for product lookup, and if we built a cross reference file that matched back to our Product Master, it would help in...
|
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 usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |