I've got one database that all my student information is in and then I've got another database that I'd like to update information based off the first database. I've got the connections working and can pull data but I'm having issues comparing the data. I'm not sure if it's the nested while nots or exactly where the problem lies. I want all the information in the web database to be updated to the exact data from the PS data. I've tried switching the locations of the while nots (made the webidrows first) and still not getting the results I want. I'm guessing I need to change the while not webidrows to something to just compare the psstunum to webstunum. Also, if either psstunum or webstunum are null (which they never should be, what would happen?
So I want the script to grab the psstunum, search the through the webidrows and if it finds a match in the webstunum column, updates the field. If it doesn't find it, I want it to insert it.
Thanks for any help you can give.
psconn.Open "DRIVER={Oracle in instantclient_11_2};DBQ=192.168.1.1:1521/DB1;uid=a;pwd=a;"
Set psrows = psconn.Execute("SELECT first_name,middle_name,last_name,entrydate,schoolid,ssn,enroll_status,locker_combination,grade_level,DOB,student_number FROM students")
webidconn.Open "Driver={SQL Server};Server=192.168.1.2;Database=WEB;Uid=b;Pwd=b"
Set webidrows = webidconn.Execute("SELECT student_number, DOB, First_Name, Last_Name, School_id, internet, grade FROM dbo.MCSD")
Set psStuFirstName = psrows.Fields("First_Name")
Set psStuLastName = psrows.Fields("Last_Name")
set psstunum = psrows.Fields("student_number")
Set webstunum = webidrows.Fields("student_number")
Set webStuFirstName = webidrows.Fields("First_Name")
Set webStuLastName = webidrows.Fields("Last_Name")
If isnull(psStuinet) then
else
psStuinet="Internet"
end if
webidconn.execute("UPDATE dbo.MCSD set path = '" & psStugrd & "' where Student_Number='" & psstunum & "'")