|
Can you please elaborate "Insert..." & "Update..." bit more? Like for what purpose you need to have two CSs? Do you want to change the database? If yes, why not do it as an intermediate SQL statement between insert & update?
|
|
|
|
|
Dear friend,
my rquiremnt is like
1. SELECT some data from servr1.db1.Tbl1
2. INSERT that to server2.db2.Tbl1.
3. UPDATE the status filed of selected data in servr1.db1.Tbl1
If either step 2 or 3 fail I need to Roll back that transaction.
any advice please..
Let me check intermediate SQL statement in my Google Uncle
They laugh at me; they think I’m different. I laugh at them, ‘coz they are all same!! CrazySanker
|
|
|
|
|
First, allow me to clear this, I used "intermediate" as an english word, not as technical word.
Theoretically, it should be like that
connect with server1
select
if it was a success
connect with server2
insert
if it was a success
disconnect with server2
update
if not success rollback
disconnect with server1
Surely, you will need to have 2 connection objects, given this is not a live server with few hundereds transactions goin on.
Hope that helps!
Adeel
|
|
|
|
|
|
Why do you need 2 connection strings? What is the purpose..changing the database while the transaction is open?
I will use Google before asking dumb questions
|
|
|
|
|
Dear friend,
my rquiremnt is like
1. SELECT some data from servr1.db1.Tbl1
2. INSERT that to server2.db2.Tbl1.
3. UPDATE the status filed of selected data in servr1.db1.Tbl1
If either step 2 or 3 fail I need to Roll back that transaction.
any advice please..
They laugh at me; they think I’m different. I laugh at them, ‘coz they are all same!! CrazySanker
|
|
|
|
|
The ConnectionString property can be set only when the connection is closed. (from MSDN) and when you close a query, the pending transactions are rolledback.
So...my suggestion is to use at least 2 connections
using (SqlConnection conn = new SqlConnection())
{
string cs1 = "connection string 1";
conn.ConnectionString = cs1;
conn.Open();
SqlTransaction trans = conn.BeginTransaction();
if (InsertSecondDB())
{
trans.Commit();
}
else
{
trans.Rollback();
}
conn.Close();
}
The InsertSecondDB should create a new connection and a new transaction to the second DataBase and return true if the query succeeded or false otherwise.
Hope it helps.
I will use Google before asking dumb questions
|
|
|
|
|
defenitely it clicked some ideas in my mind..
Thank you soo much!!
They laugh at me; they think I’m different. I laugh at them, ‘coz they are all same!! CrazySanker
|
|
|
|
|
Dear friends,
During my g0ole search i got this
Distributed Transaction ^]
They laugh at me; they think I’m different. I laugh at them, ‘coz they are all same!! CrazySanker
|
|
|
|
|
how to synchronize file on two pc
|
|
|
|
|
Hi,
There can be several ways, following are some possibilities:
1. Web-service
2. Application loaded in a hidden mode at the system start-up
In the 2nd option there can further be some possibilities as
2.a Client-Server sort of application for 2 PCs
2.b Instances of a same application on both PCs
2.c Event-Trigger sort of application, i.e. generating event and start sending changed/modified file from 1 PC to other
Hope that helps.
Regards,
Adeel
|
|
|
|
|
Hi,
Try looking at some flags of the open dialog.
Regards,
Adeel
|
|
|
|
|
is that no so...
i had seen the flags...
it should be custom control
chandru
|
|
|
|
|
Hello,
I need to find out programatically the encoding format of a text file.
Do text files, have a header which contains the encoding format.
If it does then how do I view it/access it ?
The encoding I am referring to is - ANSI, Unicode, UTF8, UTF4, etc.
Any help is appreciated.
Thanks,
\deepu
|
|
|
|
|
|
Hi,
i fill dataset with the table, i want a particular colunm data from dataset?
Yogesh Pekhale
pekhaleyogesh@gmail.com
|
|
|
|
|
For that you have to read each data row of that particular table
like
foreach (DataRow oRow in MyDataTable.Rows)
{
value = oRow["CustomerId"].ToString();
}
Where CustomerId is the column name and MyDataTable is the table name.
Regards
Pankaj Joshi
|
|
|
|
|
Thanks
Yogesh Pekhale
pekhaleyogesh@gmail.com
|
|
|
|
|
Please can any one help me in customizing the open file dialog selection.
My requirement is to select a single folder or a single file at a time using one open dialog control using C#.
chandru
|
|
|
|
|
Hello ALL,
I am creating the word document and filling it up with the tables needed. I need to add two tables adjacently , i tried giving a column break but it is not happening . If any one has some clues it will be helpfull.
Thanks in advance
Bharath.S Ron
|
|
|
|
|
Can any one help me how to get the server application path.
I have uploaded the files to the server throught FTP and now i want to prient the appliation path so can any one please help me out how to get the Application path.
Thanks in advance.
chandu
chandu
|
|
|
|
|
clife537 wrote: server application path
HttpRuntime.AppDomainAppPath
or
Server.MapPath
or
AppDomain.CurrentDomain.BaseDirectory
or
Request.Path
or
Request.PhysicalApplicationPath
Vasudevan Deepak Kumar
Personal Homepage
Tech Gossips
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
Thanks A lottt.................
I have solved the problem.
chandu
|
|
|
|
|
This website is so good for developer with C# ,I graduated from a college in china at july this year ,now I programme everyday , so many answers I can get from this website, thank you very much ,just for I am a computer lover.
welcome to make friends with people here,my email is suntiger304@qq.com.
|
|
|
|
|
super flower wrote: ,now I programme everyday
Very Good.
super flower wrote: so many answers I can get from this website
Good to hear.
super flower wrote: welcome to make friends with people here,my email is suntiger304@qq.com.
This is considered rude and impolite here. This is a technical discussions forum for health exchange of questions related to technology and knowledge sharing. If you are interested in making friends, Orkut is the best bet source for you.
Vasudevan Deepak Kumar
Personal Homepage
Tech Gossips
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|