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.StoredProcedur e
.Parameters.Add("@PolNum", SqlDbType.VarChar, 18)
.Parameters("@PolNum").Val ue = sdrBasicPolicyInfo.Item("P olNum")
.Parameters.Add("@userdate ", SqlDbType.DateTime, 18)
.Parameters("@userdate").V alue = 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!
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
With (scGet_Claim_Data)
.CommandType = CommandType.StoredProcedur
.Parameters.Add("@PolNum",
.Parameters("@PolNum").Val
.Parameters.Add("@userdate
.Parameters("@userdate").V
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.