473,385 Members | 1,707 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,385 software developers and data experts.

Trying to update exiting code for specific date

Hello,
I am trying to update an access database record date field that matches
a specific date. The code is not working. Anyone have any advice?

Here is the code:
Dim gConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Customer development\VBNET\CSFV\CSFV.mdb;"
Dim Conn As New OleDbConnection(gConnString) 'Actual
Connection to database.
Conn.Open()

Dim SqlStatement As String = "UPDATE LetterData " & _
"Set DateSenttoPrint = #" & shtDt & "# " & _
"WHERE ID = '" & RecordID & "' " & _
";"

Dim Command As New OleDbCommand(SqlStatement, Conn)
Command.ExecuteNonQuery()

Command.ExecuteNonQuery is were the code crashes.

Any advice would be apprieciated.
Lm******@yahoo.com

Aug 30 '06 #1
7 1269
Hi,

You don't know it but your question comes about 5 times a day in the dotnet
newsgroups.

The answer is than use parameters.
http://www.vb-tips.com/dbpages.aspx?...3-eb8b44af0137

And surely not that ";" at the end.

I hope this helps,

Cor

<lm******@yahoo.comschreef in bericht
news:11**********************@b28g2000cwb.googlegr oups.com...
Hello,
I am trying to update an access database record date field that matches
a specific date. The code is not working. Anyone have any advice?

Here is the code:
Dim gConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Customer development\VBNET\CSFV\CSFV.mdb;"
Dim Conn As New OleDbConnection(gConnString) 'Actual
Connection to database.
Conn.Open()

Dim SqlStatement As String = "UPDATE LetterData " & _
"Set DateSenttoPrint = #" & shtDt & "# " & _
"WHERE ID = '" & RecordID & "' " & _
";"

Dim Command As New OleDbCommand(SqlStatement, Conn)
Command.ExecuteNonQuery()

Command.ExecuteNonQuery is were the code crashes.

Any advice would be apprieciated.
Lm******@yahoo.com

Aug 30 '06 #2
Thank you, I will look at the information. I forgot to mention (hope
this doesn't change the answer but) the database and record current has
a reader attached to it before the update. So, The reader is done to
find the record then I want to update it, how is the question?

Thanks for any information.

Cor Ligthert [MVP] wrote:
Hi,

You don't know it but your question comes about 5 times a day in the dotnet
newsgroups.

The answer is than use parameters.
http://www.vb-tips.com/dbpages.aspx?...3-eb8b44af0137

And surely not that ";" at the end.

I hope this helps,

Cor

<lm******@yahoo.comschreef in bericht
news:11**********************@b28g2000cwb.googlegr oups.com...
Hello,
I am trying to update an access database record date field that matches
a specific date. The code is not working. Anyone have any advice?

Here is the code:
Dim gConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Customer development\VBNET\CSFV\CSFV.mdb;"
Dim Conn As New OleDbConnection(gConnString) 'Actual
Connection to database.
Conn.Open()

Dim SqlStatement As String = "UPDATE LetterData " & _
"Set DateSenttoPrint = #" & shtDt & "# " & _
"WHERE ID = '" & RecordID & "' " & _
";"

Dim Command As New OleDbCommand(SqlStatement, Conn)
Command.ExecuteNonQuery()

Command.ExecuteNonQuery is were the code crashes.

Any advice would be apprieciated.
Lm******@yahoo.com
Aug 30 '06 #3
It would have changed the answer if that was not.

Cor

<lm******@yahoo.comschreef in bericht
news:11**********************@p79g2000cwp.googlegr oups.com...
Thank you, I will look at the information. I forgot to mention (hope
this doesn't change the answer but) the database and record current has
a reader attached to it before the update. So, The reader is done to
find the record then I want to update it, how is the question?

Thanks for any information.

Cor Ligthert [MVP] wrote:
>Hi,

You don't know it but your question comes about 5 times a day in the
dotnet
newsgroups.

The answer is than use parameters.
http://www.vb-tips.com/dbpages.aspx?...3-eb8b44af0137

And surely not that ";" at the end.

I hope this helps,

Cor

<lm******@yahoo.comschreef in bericht
news:11**********************@b28g2000cwb.googleg roups.com...
Hello,
I am trying to update an access database record date field that matches
a specific date. The code is not working. Anyone have any advice?

Here is the code:
Dim gConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Customer development\VBNET\CSFV\CSFV.mdb;"
Dim Conn As New OleDbConnection(gConnString) 'Actual
Connection to database.
Conn.Open()

Dim SqlStatement As String = "UPDATE LetterData " & _
"Set DateSenttoPrint = #" & shtDt & "# " & _
"WHERE ID = '" & RecordID & "' " & _
";"

Dim Command As New OleDbCommand(SqlStatement, Conn)
Command.ExecuteNonQuery()

Command.ExecuteNonQuery is were the code crashes.

Any advice would be apprieciated.
Lm******@yahoo.com

Aug 30 '06 #4
I didn't see anything on that website about updating a record. Do you
have another resource to view?


Cor Ligthert [MVP] wrote:
It would have changed the answer if that was not.

Cor

<lm******@yahoo.comschreef in bericht
news:11**********************@p79g2000cwp.googlegr oups.com...
Thank you, I will look at the information. I forgot to mention (hope
this doesn't change the answer but) the database and record current has
a reader attached to it before the update. So, The reader is done to
find the record then I want to update it, how is the question?

Thanks for any information.

Cor Ligthert [MVP] wrote:
Hi,

You don't know it but your question comes about 5 times a day in the
dotnet
newsgroups.

The answer is than use parameters.
http://www.vb-tips.com/dbpages.aspx?...3-eb8b44af0137

And surely not that ";" at the end.

I hope this helps,

Cor

<lm******@yahoo.comschreef in bericht
news:11**********************@b28g2000cwb.googlegr oups.com...
Hello,
I am trying to update an access database record date field that matches
a specific date. The code is not working. Anyone have any advice?

Here is the code:
Dim gConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Customer development\VBNET\CSFV\CSFV.mdb;"
Dim Conn As New OleDbConnection(gConnString) 'Actual
Connection to database.
Conn.Open()

Dim SqlStatement As String = "UPDATE LetterData " & _
"Set DateSenttoPrint = #" & shtDt & "# " & _
"WHERE ID = '" & RecordID & "' " & _
";"

Dim Command As New OleDbCommand(SqlStatement, Conn)
Command.ExecuteNonQuery()

Command.ExecuteNonQuery is were the code crashes.

Any advice would be apprieciated.
Lm******@yahoo.com
Aug 30 '06 #5
Hello,
I hit upon a website that says Reader is only for reading data. Is that
true? Should I use an adapter for doing updating?

lm******@yahoo.com wrote:
I didn't see anything on that website about updating a record. Do you
have another resource to view?


Cor Ligthert [MVP] wrote:
It would have changed the answer if that was not.

Cor

<lm******@yahoo.comschreef in bericht
news:11**********************@p79g2000cwp.googlegr oups.com...
Thank you, I will look at the information. I forgot to mention (hope
this doesn't change the answer but) the database and record current has
a reader attached to it before the update. So, The reader is done to
find the record then I want to update it, how is the question?
>
Thanks for any information.
>
Cor Ligthert [MVP] wrote:
>Hi,
>>
>You don't know it but your question comes about 5 times a day in the
>dotnet
>newsgroups.
>>
>The answer is than use parameters.
>http://www.vb-tips.com/dbpages.aspx?...3-eb8b44af0137
>>
>And surely not that ";" at the end.
>>
>I hope this helps,
>>
>Cor
>>
><lm******@yahoo.comschreef in bericht
>news:11**********************@b28g2000cwb.googleg roups.com...
Hello,
I am trying to update an access database record date field that matches
a specific date. The code is not working. Anyone have any advice?
>
Here is the code:
Dim gConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Customer development\VBNET\CSFV\CSFV.mdb;"
Dim Conn As New OleDbConnection(gConnString) 'Actual
Connection to database.
Conn.Open()
>
Dim SqlStatement As String = "UPDATE LetterData " & _
"Set DateSenttoPrint = #" & shtDt & "# " & _
"WHERE ID = '" & RecordID & "' " & _
";"
>
Dim Command As New OleDbCommand(SqlStatement, Conn)
Command.ExecuteNonQuery()
>
Command.ExecuteNonQuery is were the code crashes.
>
Any advice would be apprieciated.
Lm******@yahoo.com
>
>
Aug 30 '06 #6
The simplest way as you do it, is as you trying to do therefore try that at
least first: be aware that in this way you are not checking if somebody else
has done a concurrent update.

Cor

<lm******@yahoo.comschreef in bericht
news:11********************@h48g2000cwc.googlegrou ps.com...
Hello,
I hit upon a website that says Reader is only for reading data. Is that
true? Should I use an adapter for doing updating?

lm******@yahoo.com wrote:
>I didn't see anything on that website about updating a record. Do you
have another resource to view?


Cor Ligthert [MVP] wrote:
It would have changed the answer if that was not.

Cor

<lm******@yahoo.comschreef in bericht
news:11**********************@p79g2000cwp.googlegr oups.com...
Thank you, I will look at the information. I forgot to mention (hope
this doesn't change the answer but) the database and record current
has
a reader attached to it before the update. So, The reader is done to
find the record then I want to update it, how is the question?

Thanks for any information.

Cor Ligthert [MVP] wrote:
Hi,

You don't know it but your question comes about 5 times a day in the
dotnet
newsgroups.

The answer is than use parameters.
http://www.vb-tips.com/dbpages.aspx?...3-eb8b44af0137

And surely not that ";" at the end.

I hope this helps,

Cor

<lm******@yahoo.comschreef in bericht
news:11**********************@b28g2000cwb.googleg roups.com...
Hello,
I am trying to update an access database record date field that
matches
a specific date. The code is not working. Anyone have any advice?

Here is the code:
Dim gConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Customer development\VBNET\CSFV\CSFV.mdb;"
Dim Conn As New OleDbConnection(gConnString) 'Actual
Connection to database.
Conn.Open()

Dim SqlStatement As String = "UPDATE LetterData " & _
"Set DateSenttoPrint = #" & shtDt & "# " &
_
"WHERE ID = '" & RecordID & "' " & _
";"

Dim Command As New OleDbCommand(SqlStatement, Conn)
Command.ExecuteNonQuery()

Command.ExecuteNonQuery is were the code crashes.

Any advice would be apprieciated.
Lm******@yahoo.com


Aug 31 '06 #7
ISSUE is resolved. Thank you all that helped.

Loaded array with unigue ID as the reader was going line by line. Then
when done with reader before exiting the module called another function
to step thru the array to update the table with date sent to print.

Works like a charm.
Cor Ligthert [MVP] wrote:
The simplest way as you do it, is as you trying to do therefore try that at
least first: be aware that in this way you are not checking if somebody else
has done a concurrent update.

Cor

<lm******@yahoo.comschreef in bericht
news:11********************@h48g2000cwc.googlegrou ps.com...
Hello,
I hit upon a website that says Reader is only for reading data. Is that
true? Should I use an adapter for doing updating?

lm******@yahoo.com wrote:
I didn't see anything on that website about updating a record. Do you
have another resource to view?


Cor Ligthert [MVP] wrote:
It would have changed the answer if that was not.

Cor

<lm******@yahoo.comschreef in bericht
news:11**********************@p79g2000cwp.googlegr oups.com...
Thank you, I will look at the information. I forgot to mention (hope
this doesn't change the answer but) the database and record current
has
a reader attached to it before the update. So, The reader is done to
find the record then I want to update it, how is the question?
>
Thanks for any information.
>
Cor Ligthert [MVP] wrote:
>Hi,
>>
>You don't know it but your question comes about 5 times a day in the
>dotnet
>newsgroups.
>>
>The answer is than use parameters.
>http://www.vb-tips.com/dbpages.aspx?...3-eb8b44af0137
>>
>And surely not that ";" at the end.
>>
>I hope this helps,
>>
>Cor
>>
><lm******@yahoo.comschreef in bericht
>news:11**********************@b28g2000cwb.googleg roups.com...
Hello,
I am trying to update an access database record date field that
matches
a specific date. The code is not working. Anyone have any advice?
>
Here is the code:
Dim gConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\Customer development\VBNET\CSFV\CSFV.mdb;"
Dim Conn As New OleDbConnection(gConnString) 'Actual
Connection to database.
Conn.Open()
>
Dim SqlStatement As String = "UPDATE LetterData " & _
"Set DateSenttoPrint = #" & shtDt & "# " &
_
"WHERE ID = '" & RecordID & "' " & _
";"
>
Dim Command As New OleDbCommand(SqlStatement, Conn)
Command.ExecuteNonQuery()
>
Command.ExecuteNonQuery is were the code crashes.
>
Any advice would be apprieciated.
Lm******@yahoo.com
>
>
Aug 31 '06 #8

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

Similar topics

1
by: malvina shagabayeva | last post by:
I need to set up a system that will keep track of my daily updates in the DB. I would like the user to see a message after opening the database, that would display that the last update was done on...
1
by: Del | last post by:
We have a MS SQL Server 2000 application for our shipping system. We have created a front end application using MS Access for our order analyst. The front end application allows the analyst to...
4
by: The Spoon | last post by:
I am looking for functions that can be used to automatically update the system date and time on an NT based system, resulting from manually entered date and time values input by an operator via a...
3
by: Kenneth P | last post by:
Hi, I have a very good book on asp.net Sams ASP.NET Tips, Tutorials and Code ISBN 0-672-32143-2 and is trying to teach myself from examples from this book Chapter 16. Anyway I come quite...
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
1
by: Mok | last post by:
Hello, I want to pull information from a table in sql server, bind it to a grid and update those values. I would like to know the best way to do it. I used the configure data adapter wizard and it...
5
by: Learner | last post by:
Hello, Here is the code snippet I got strucked at. I am unable to convert the below line of code to its equavalent vb.net code. could some one please help me with this? static public...
22
by: Zytan | last post by:
I have public methods in a form. The main form calls them, to update that form's display. This form is like a real-time view of data that is changing. But, the form may not exist (it is...
4
by: Dr Al | last post by:
I have a project which requires the batch import of customer contact information, print mailing labels for those customers who have their date of first letter field in the database set to null, and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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...

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.