|
You're welcome.
|
|
|
|
|
I am working on a program that accesses two different databases. One of them has only one table and I am not having any problems with access/working it. The second database has three tables in it that I need access to and this is where the problems arise.
I have no problem reading the tables. I can navigate the records and even delete them without issues. However when I try to update a record, or add a record to the database I get the following error messages:
When trying to edit/update a record:
System.Data.OleDb.OleDbException was unhandled
ErrorCode=-2147217900
Message=Syntax error in UPDATE statement.
When trying to add a record:
System.Data.OleDb.OleDbException was unhandled
ErrorCode=-2147217900
Message=Syntax error in INSERT INTO statement.
I have looked over the code time and time again and I can't find anything wrong with it. It is identical to the code that I currently have working with the single table database. Below is one of the code blocks that I am having issues with:
Private Sub btnCommitSignin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCommitSignin.Click
Dim SignCB As New OleDb.OleDbCommandBuilder(SignDataAdapter)
Dim SignNewRecord As DataRow
SignNewRecord = SignDataSet.Tables("SignIn").NewRow()
SignNewRecord.Item(2) = cmbpatronsignin.Text
SignNewRecord.Item(1) = txtDateSignin.Text
SignNewRecord.Item(3) = txtTimeIn.Text
SignNewRecord.Item(4) = txtTimeOut.Text
SignDataSet.Tables("SignIn").Rows.Add(SignNewRecord)
SignDataAdapter.Update(SignDataSet, "SignIn")
MsgBox("New sign-in registered.")
SignMaxRows = SignMaxRows + 1
SignInc = 0
NavigateSignInRecords()
cmbpatronsignin.Visible = False
txtDateSignin.Visible = False
txtTimeIn.Visible = False
txtTimeOut.Visible = False
btnAddSignIn.Visible = True
btnEditSignin.Visible = True
btnDeleteSignin.Visible = True
btnCommitSignin.Visible = False
btnApproveSignin.Visible = False
btnCancelSignIn.Visible = False
End Sub
The program always crashes at the line:
SignDataAdapter.Update(SignDataSet, "SignIn")
If I comment it out and rerun the program, the dataset updates without any problems so I know that it has to do with the update command.
What could be some of the issues that I am having? What are the solutions to them?
|
|
|
|
|
The error explains it pretty obviously. The SQL statement you have for INSERT is screwed up somehow. Since you didn't provide that code, there's no way to tell you what's wrong with it.
|
|
|
|
|
You have not given us enough information to see the problem. Have a look at this[^] and make sure you are following the rules.
|
|
|
|
|
i want to vb two resourse
|
|
|
|
|
What?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
See here[^].
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
|
|
|
|
|
Yeah? People in Hell want ice water.
What are you talking about??
|
|
|
|
|
in a particular color?
|
|
|
|
|
Toasted!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
that is no specification, I can toast things to most any color you like, especially dark black.
|
|
|
|
|
I always wondered that about toasters, they have a setting on the side that allows you to choose how much you want to toast something.
But 6 of the settings burn the toast and 2 of them don't toast it at all.
So why bother?
Can they not just make a toaster that Toasts?
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC League Table Link
CCC Link[
|
|
|
|
|
you obviously lack the Fingerspitzengefühl it takes to set the control right.
Basically the problem is the control system: rather than setting power and duration in advance (and hope for the best), they should use a sensor and a feedback control system. However that would make the equipment slightly more expensive, and offer more customer satisfaction, two characteristics that work against the business proper.
|
|
|
|
|
1. Turn on the broiler
2. Butter the bread
3. Place bread slices on ungreased cookie sheet
4. Place in oven on top shelf
5. Count to 20 (1-hippopotamus, 2-hippopotamus...)
6. Remove toast from oven and enjoy
Glad I could help!
Everybody SHUT UP until I finish my coffee...
|
|
|
|
|
we don't have 20 hippopotamuses in our small country, so we count crocodiles if anything. Would that be all right too?
|
|
|
|
|
Luc Pattyn wrote: ...so we count crocodiles if anything. Would that be all right too?
That'd work, although I'd count them from a distance. We have alligators in my part of the world - not the friendliest creatures I've ever seen. Although they're great for sausage.
Everybody SHUT UP until I finish my coffee...
|
|
|
|
|
this is my code
selectdata2 = "SELECT Students.[Name 1], Students.[Name 2], Students.[Name 3], Students.[ID number], StudentClass.Class FROM Students INNER JOIN StudentClass ON Students.[ID number] = StudentClass.[ID number] WHERE ((StudentClass.Class>=100) And (StudentClass.Class<=1209) AND (StudentClass.Position=1)) ORDER BY Students.[Name 1]"
but give me this error "IErrorInfo.GetDescription failed with E_FAIL(0x80004005)"
this work when I remove "StudentClass.Position=1" from where clause. And I use MS access 2003 database.
|
|
|
|
|
Did you try using StudentClass.[Position] ?
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Thanks a lot, it worked for me.........thnks friend....
|
|
|
|
|
ivo75 wrote: this is my code
Please don't use spaces in your fieldnames. You might find it more readable, but the computer will be reading it more often than you will. Once the spaces are gone, you can drop the brackets around those names, which could simplify the statement a lot;
SELECT Students.FirstName
, Students.SecondName
, Students.ThirdName
, Students.Identification
, StudentClass.Class
FROM Students
INNER JOIN StudentClass ON Students.Identification = StudentClass.Identification
WHERE StudentClass.Class>=100
AND StudentClass.Class<=1209
AND StudentClass.Position=1
ORDER BY Students.FistName
ivo75 wrote: but give me this error "IErrorInfo.GetDescription failed with E_FAIL(0x80004005)"
According to Google, this could be caused by having a reserved keyword as a fieldname. You'll need a new naming-convention
I are Troll
|
|
|
|
|
Next time you've got a SQL problem, ask in the General Database forum. This has nothing to do with VB.NET.
|
|
|
|
|
Hello Everybody!
I've been puzzling all day over how I would go about giving a custom application icon to a VB.NET executable compiled from VB.NET 2010 code using the VBCodeProvider class.
My application compiles VB.NET source code into a .NET executable like this:
Dim MyCodeProvider As New VBCodeProvider
Dim MyCompilerOptions As New CompilerParameters
MyCompilerOptions.GenerateExecutable = True
MyCodeProvider.CompileAssemblyFromSource(MyCompilerOptions, MySourceCode)
That's working great, but I can't find a way to assign custom application icons to the generated executables. I've tried using a ResourceWriter to create a resources file with the icon in it and embedding that in the executable like so:
Dim MyResourceWriter As New ResourceWriter("C:\AppResources.resources")
MyResourceWriter.AddResource("APPICON", New Drawing.Icon("C:\AppIcon.ico"))
MyResourceWriter.Generate()
MyResourceWriter.Close()
MyCompilerOptions.EmbeddedResources.Add("C:\AppResources.resources")
However, though the generated executable increases in size (which leads me to think that the icon data is in there somewhere), the icon still doesn't show up as the application icon in Windows Explorer.
I'm a real novice at using resource files, and I just can't get it to work. Can anybody see what I'm doing wrong?
Thanks in advance!
MrWolfy
modified on Saturday, December 25, 2010 5:30 PM
|
|
|
|
|
|
Hi!
Perfect! Absolutely exactly what I was looking for, thank you very much indeed for the link!
Thanks Again!
MrWolfy
|
|
|
|
|
You're welcome
|
|
|
|