473,804 Members | 3,572 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=Micro soft.Jet.OLEDB. 4.0;Data
Source=C:\Custo mer development\VBN ET\CSFV\CSFV.md b;"
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(Sq lStatement, Conn)
Command.Execute NonQuery()

Command.Execute NonQuery is were the code crashes.

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

Aug 30 '06 #1
7 1283
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.goo glegroups.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=Micro soft.Jet.OLEDB. 4.0;Data
Source=C:\Custo mer development\VBN ET\CSFV\CSFV.md b;"
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(Sq lStatement, Conn)
Command.Execute NonQuery()

Command.Execute NonQuery 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.goo glegroups.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=Micro soft.Jet.OLEDB. 4.0;Data
Source=C:\Custo mer development\VBN ET\CSFV\CSFV.md b;"
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(Sq lStatement, Conn)
Command.Execute NonQuery()

Command.Execute NonQuery 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.goo glegroups.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******@yaho o.comschreef in bericht
news:11******* *************** @b28g2000cwb.go oglegroups.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=Micro soft.Jet.OLEDB. 4.0;Data
Source=C:\Custo mer development\VBN ET\CSFV\CSFV.md b;"
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(Sq lStatement, Conn)
Command.Execute NonQuery()

Command.Execute NonQuery 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.goo glegroups.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.goo glegroups.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=Micro soft.Jet.OLEDB. 4.0;Data
Source=C:\Custo mer development\VBN ET\CSFV\CSFV.md b;"
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(Sq lStatement, Conn)
Command.Execute NonQuery()

Command.Execute NonQuery 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.goo glegroups.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******@yaho o.comschreef in bericht
>news:11******* *************** @b28g2000cwb.go oglegroups.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=Micro soft.Jet.OLEDB. 4.0;Data
Source=C:\Custo mer development\VBN ET\CSFV\CSFV.md b;"
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(Sq lStatement, Conn)
Command.Execute NonQuery()
>
Command.Execute NonQuery 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******** ************@h4 8g2000cwc.googl egroups.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.goo glegroups.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******@yaho o.comschreef in bericht
news:11******* *************** @b28g2000cwb.go oglegroups.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=Micro soft.Jet.OLEDB. 4.0;Data
Source=C:\Custo mer development\VBN ET\CSFV\CSFV.md b;"
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(Sq lStatement, Conn)
Command.Execute NonQuery()

Command.Execute NonQuery 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******** ************@h4 8g2000cwc.googl egroups.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.goo glegroups.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******@yaho o.comschreef in bericht
>news:11******* *************** @b28g2000cwb.go oglegroups.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=Micro soft.Jet.OLEDB. 4.0;Data
Source=C:\Custo mer development\VBN ET\CSFV\CSFV.md b;"
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(Sq lStatement, Conn)
Command.Execute NonQuery()
>
Command.Execute NonQuery 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
1481
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 #date#. Any suggestions will be greatly appreciated. Malvina S *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
1
2808
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 review and update orders before they are released to the warehouse. We are in the test phase of this project and have run into a couple problems that we just can not figure out. During the testing phase there is only one person working in the...
4
7190
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 32-bit console app. Any ideas?..I may have to look further afield at Win32 API's, etc but I wondered if there was any way to do it via C initially. Merry Xmas to all !!!
3
2097
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 close when trying to run one example but then I get this message I don't understand: "This .resources file shouldn't be used with this reader. Your resource
25
4078
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
1
2778
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 came up with a crazy stored proc. As in this example I would only update and : CREATE PROCEDURE . ( @Description varchar(1000),
5
3795
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 List<RoleData> GetRoles() { return GetRoles(null, false); }
22
3095
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 created / destroyed at user request). I can check form != null to prevent incorrect access. But, the form could disappear immediately after the check, before the method is run. Or someone could click 'close' when it's in the middle of an update. ...
4
2036
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 update the date of first letter field with the date the mailing labels are printed. I already have a query which checks the date of first letter field, and returns those customers whose date of first letter field is null. How do I setup to...
0
9704
marktang
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...
0
9569
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10558
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10318
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10302
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,...
1
7608
isladogs
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...
0
5503
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...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2975
bsmnconsultancy
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.