sguda
13 years agoRegular Contributor
I need retrieve the database record through scripting with variable value
Hi
I am accessing the database and trying to retrieve the record with primary key matching the variable value. When i give the direct value instead of Variable i am able to retrieve. But when i am using variable i am getting error. So please suggest me where i am doing wrong. I am trying to use variable for SSN values
Delete_Eligibilty_Records
aCon1.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=Eligibility"
I am accessing the database and trying to retrieve the record with primary key matching the variable value. When i give the direct value instead of Variable i am able to retrieve. But when i am using variable i am getting error. So please suggest me where i am doing wrong. I am trying to use variable for SSN values
Sub Delete_Eligibilty_Records
Delete_Eligibilty_Records
Dim Eligibilty_ID ,Award_Year, Eligibilty_Details_ID, Stud_Id , Stud_SSN
Stud_SSN = 594823868
Set aCon1 = ADO.CreateADOConnection
aCon1.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=Eligibility"
aCon1.LoginPrompt = False
aCon1.Open
Set Recset4 = aCon1.Execute_("select IDStudent from Student where (SSN = Stud_SSN) ")
RecSet4.MoveFirst
While Not RecSet4.EOF
If RecSet4.Fields("IDStudent").Value > "" Then
Log.Message RecSet4.Fields("IDStudent").Value
Stud_Id = RecSet4.Fields("IDStudent").Value
Log.Message Stud_Id
End If
RecSet4.MoveNext
Wend