Question

I want to create a transaction, so I write the following: Dim myconn as new Connection()....

I want to create a transaction, so I write the following:

Dim myconn as new Connection().

Dim mytxn as new Transaction().

mytxn=myconn;

these statements are giving me an execution error (not a compilation/syntax error). white these statements properly.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

you are assigning two different things - connection to transaction
mytxn=myconn; which is wrong
It should be
mytxn=myconn.BeginTransaction();
// then do the database things, insert update …. ./
/and finally commit transaction & close connection as follows
mytxn.Commit()
myconn.Close()

the database code depends on which type of connection you want to use

that is oledb, sql or adodb connections.

found some links that may be useful

for SqlConnection, SqlTransaction
https://www.dotnetheavencom/article/transaction-in-vb.net

for OleDb connection, OleDb transaction

http://www.vb-helper.com/howto_net_db_transaction.html

thanks..

Add a comment
Know the answer?
Add Answer to:
I want to create a transaction, so I write the following: Dim myconn as new Connection()....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You need to create your own connection string. So you need to know what each of...

    You need to create your own connection string. So you need to know what each of the parts of the connection string mean. The connection string needs to know the location where the SQL Server resides, and that's usually a domain name or IP address. This may vary! Then you need to know who you are talking to, and that is the name of the server. This is the initial catalog. The AttachDbFilename shows the name of the file and...

  • Answer the following and explain so I can double check my answers If you use the Management Studio to create a database, the Studio will automatically create a database file plus a ________________...

    Answer the following and explain so I can double check my answers If you use the Management Studio to create a database, the Studio will automatically create a database file plus a ______________________ file. 10 points    QUESTION 2 When you use the Management Studio to create a check constraint, you can specify whether you want the constraint enforced for insert or __________________ operations. 10 points    QUESTION 3 When you use the Management Studio to create a database, including its tables...

  • I want to do research essay for a following topic. to create  platform for an airline company...

    I want to do research essay for a following topic. to create  platform for an airline company to track parts for all models. the application can provide what is already installed, maintenance parts left , new parts, refurbished parts..etc to create this essay based proposal, I need to follow this steps 1.introduction 2. The problem 3. The Goals 5.The Deadlines 6.The cost can you write two -three pages following the steps above? thank you

  • Answer the following questions so I can double check my work Controls the flow of execution...

    Answer the following questions so I can double check my work Controls the flow of execution based on a condition begin...end try...catch goto if...else 10 points    QUESTION 2 Changes the database context to the specified database. set alter exec use 10 points    QUESTION 3 Exits the innermost WHILE loop. goto quit return break 10 points    QUESTION 4 Controls the flow of execution when an error occurs declare on error goto try...catch continue...error 10 points    QUESTION 5...

  • What I need: Create a new program named Reverse4 and declare four integer variables with the...

    What I need: Create a new program named Reverse4 and declare four integer variables with the values 23, 45, 55, and 67. Add a method named Reverse that reverses the positions of four integer variables. The Reverse method should accept the variables as references. Write a Main() method that displays the four variables both before and after reversing them to ensure the method works correctly. What I have: using System; class Reverse4 { public static void reverse(ref int num1, ref...

  • I need a small website that to where I need to interlink a CSS file into...

    I need a small website that to where I need to interlink a CSS file into the HTML file. I don't know to save the files to have to be able to run with the CSS attributes show up in the browser when I do click the "open with" after I click on the saved HTML file. Basically when I copy files from the internet, to see if the HTML and CSS would interlink and run, the HTML would run...

  • I've decided I want to create my own new type of Colour representation! I call it...

    I've decided I want to create my own new type of Colour representation! I call it ROYGBIVT: Red, Orange, Yellow, Green, Blue, Indigo, Violet, Tartan. Each of those eight colours will be treated as an individual colour channel for each pixel. Each channel will be represented by a 2-bit value. What is the maximum possible number of colours representable for each pixel? And... prove it!

  • please use c programme Write a program which simulates a calculator using the following specifications. (50...

    please use c programme Write a program which simulates a calculator using the following specifications. (50 points - 10pts for syntax, 10pts for commenting and 30pts for successful execution) • User input must have the following format - value1 operator value2 • Compute value1 operator value2 • Use switch statement • Operators must be ’+’ ,’-’, ’*’, ’/’ and ’%’ • Division by 0 in C leads to an error. Terminate the program before divison occurs in such cases. •...

  • Problem 1 Which of the following information is specified by a bitcoin transaction: A. A number...

    Problem 1 Which of the following information is specified by a bitcoin transaction: A. A number of inputs (coins being consumed ). B. A number of outputs (coins being created). C. The user's account balance. Problem 2 In a Bitcoin transaction, which of the following statements is INCORRECT when Alice wants to pay Bob 19 bitcoins to Bob (given the output she owns is worth 25 bitcoin): A. Alice needs to create a new output where all 25 bitcoins are...

  • Language: Java I am looking to create a .java class that will do the following for...

    Language: Java I am looking to create a .java class that will do the following for me: For example I search "sword" and if a line contains the text sword (in the following fomat), Then it changes the line "equipment-slot": RING, to equipment-slot": WEAPON, "id": 6605, "name": "White sword", "examine": "It's a White sword.", "equipment-slot": RING, "stackable": false,

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT