Link to home
Start Free TrialLog in
Avatar of tobin46
tobin46

asked on

Connecting to same database at the same time

Hi:  
In a function where I'm gathering claim data per policy, I execute a stored procedure and the result set returned with the following code:
scGet_Claim_Data = New SqlCommand("Get_Claim_Data", scDBConnection)
                    With (scGet_Claim_Data)
                        .CommandType = CommandType.StoredProcedure
                        .Parameters.Add("@PolNum", SqlDbType.VarChar, 18)
                        .Parameters("@PolNum").Value = sdrBasicPolicyInfo.Item("PolNum")
                        .Parameters.Add("@userdate", SqlDbType.DateTime, 18)
                        .Parameters("@userdate").Value = dteuserdate
                        sdrLossRecordInfo = .ExecuteReader()
                    End With
I have created structures that will assemble the data returned and write it to a text file.

There is one trigger for a particular field that will require another query to be run against the same database to gather additional information.  

IF a claim meets this requirement, I want to pass, Policy Number and Claim Number to another function and a procedure that would be connecting to the same database.  Could I re-use the connection since it would still be open in the other function?  Or would I simply need to create another connection using the same connection string?

For example, the connection string used above is scDBConnection, would I just need to create scDBConnection2?  Can I even do that since there is a live connection against the database?

Trying to plan on how to accomplish this...Thanks!
ASKER CERTIFIED SOLUTION
Avatar of ajitha75
ajitha75
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial