|
shakti5385 wrote: How to use connection.begintransaction in the vb.net
You put the BeginTransaction at the start of your queries. If you have an error then use RollbackTransaction to undo the changes you've made on the database. If everything works then put CommitTransaction at the end and close the connection.
A note of caution: While a transaction is in progress parts of the database will get locked out from other processes that are trying to access it. This is to ensure the safety of the transaction and other processes that are accessing the database. When you start a transaction perform the queries you need quickly so that the locks don't last long. And do not wait for user input inside a transaction.
|
|
|
|
|
can you have any code so please send me
Nothing is Impossible in Life Need Is Try for It
Think Big Get Big
Don’t Forget To Rank Best Post
|
|
|
|
|
myConnection.BeginTransaction()
If someErrorHappened Then
myConnection.RollbackTransaction()
Return
End If
myConnection.CommitTransaction()
|
|
|
|
|
Thanks Friend
Nothing is Impossible in Life Need Is Try for It
Think Big Get Big
Don’t Forget To Rank Best Post
|
|
|
|
|
Hi.
Can anyone offer some assistance with creating an invoice in vb express 2005. perhaps some code examples etc.
i looked around and can find example like richtextbox printing etc.
Thanks.
Robbo
|
|
|
|
|
Hello to all, I am a newbie with the visual basic language and i am currently building a small application for my company to edit a specific part of a database. I am using the ado data control for this and i have everything functioning expect for my delete button, thing is it works but it only deletes one record from the field whereas i would like it to delete all the records in the field that match the data in a text box that data is entered into by the user. Please any help would be appreciated, i've been fighting for weeks with this. I even tried using sql queries and they fail me as well, cause my delete command doesn't seem to work. Feel free to ask questions if i haven't made my self clear enough. Thank you.
|
|
|
|
|
govagedon wrote: but it only deletes one record from the field whereas i would like it to delete all the records in the field that match the data in a text box that data is entered into by the user.
What is the SQL query you are using?
|
|
|
|
|
Hi there.
There is many ways to identify data to be deleted. You can either delete data from x Value to y Value or with wildcards (*) or specific data only.
Here is some samples
DELETE * FROM Table WHERE ColumnA = Value1 AND/OR ColumnB = Value2
DELETE * FROM Table WHERE ColumnA = LIKE '%Value1' -> String Type Data (wildcard method)
DELETE * FROM Table WHERE ColumnA BETWEEN Value1 AND Value2
Hope this is helpfull
Regards, Werries
A programmer's life is good... or is it?? Ek dink nie so nie!
|
|
|
|
|
To chandram i've used sql queries similar to the ones that Werries has posted. And very time i try to move to the next line when i finish typing it in i get this error "compile error, expected expression" and it highlight the asterik. If i try the "delete from" command" it hightlights my table name and give the same error.
Here's the code i've wirtten
<pre>confirm = MsgBox("Are you sure you want to delete these records", vbYesNo, "CAUTION")
If confirm = vbYes Then
delete from pay_payment_history02 where process_we_date= like 'we_date.textbox'
MsgBox "Records Deleted", , "Message"
Else
MsgBox "Records not deleted", , "message"
End If</pre>
pay_payment_history02 = table name
process_we_date = field name
we_date.textbox = text box where the user selects the date to be deleted from the datafield.
Thanks for the help Werries your welcome to give any more advice if you have i'm looking for lots of it, like i said i'm new at this.So its sort of like a practice program.
|
|
|
|
|
govagedon,
Check with this sql statement
delete from pay_payment_history02 where process_we_date= like '" & we_date.textbox & "'"
This we_date.textbox is a variable you have declared in VB6/VB.Net. I hope this would solve your problem.
Regards,
Manowj
|
|
|
|
|
hello manowj,
i inserted the statment into my code, now i've encountered another error. Vb gives me the following error, "compile error, syntax error" then when i click ok it highlights the entire line of code you gave to me. any idea as to why that may be happening?
Thanks,
govagedon
|
|
|
|
|
I am using VB 2005 Express Edition and i am trying to deploy my porgram and i can publish it with no problem but when i go to run the program outside the VB environment it crashes. Anyone can tell me or direct to a sort of step by step so i can make sure i did it right?
thanks
|
|
|
|
|
Crashes with what error message?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Is the .NET framework installed on the target machine ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Swisher24 wrote: I'm having issues can anyone help?
And those would be ......?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Still not enough information. What error messages are you getting? Also, you typed the code into your post - DON'T. ALWAYS copy and paste your code into your posts here. It saves us from chasing down bugs you typed in here, but didn't type into your actual code.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Last time I'm going to ask - What's the exception and on what line of code does it show up? Copy and paste the code where the problem shows up! There is NOTHING anyone can do to help you unless you do this...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
You haven't read either of my last 2 posts, have you?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Don't even bother with it...
-- modified at 14:21 Friday 22nd December, 2006
Swish
|
|
|
|
|
How on earth do you expect anyone to help you if you don't tell them what the error is or on what line code it happens on or what the REAL code looks like? The stuff you originally posted wouldn't even compile and there were "substitutions" where you just look the liberty of removing the code, like your SQL Insert statement...
You already had the correct pieces in place, so telling you to load the data into a DataSet and write it to your database was pretty much pointless.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
You didn't get it when I said I was "New" to this, so being new doesn't mean that I already know what to do or what to say. Thats why I asked for help. So let it go...
Swish
|
|
|
|
|
I told you what we needed a few times, so that's no excuse for not listening.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
And then he starts deleting posts, and screwing up the boards.
I hate to sound like an old man, but I don't recall people acting this entitled, or getting uptight when help doesn't come in the way they hoped, when I was starting out.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: I hate to sound like an old man, but I don't recall people acting this entitled
That makes two of us. Oh, crap! We are getting old!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Swisher24 wrote: You didn't get it when I said I was "New" to this, so being new doesn't mean that I already know what to do or what to say. Thats why I asked for help. So let it go...
Look don't get uppity with the people here. We try and help out in our free time out of good will. We are not paid for this and we don't have to give help. However, it is obvious that you did not supply the information that it would take to answer your question. We, and specifically Dave in this case, are trying to help you. If you didn't know how to get at the information then ask that. Don't delete your posts in a huff and tell people to forget it. They've taken time out from doing something else to help you.
You can always go to Microsoft support for help. They will help you do whatever you like for a small fee.
|
|
|
|