Jump to content

Recordset Problem SQL Server


katty
 Share

Recommended Posts

Have converted Access Databank to SQL Server.After that my Recorsets are not working properly.Im using (ASP Classic).For example a simple Select * from say a table with following components:surnamevornamestreettownIf I try to call vorname before surname nothing appears but if I follow the order that the components of the table are listed then everything is fine.Can anyone explain whats going on???Thanks in advance

Link to comment
Share on other sites

Have converted Access Databank to SQL Server.After that my Recorsets are not working properly.Im using (ASP Classic).For example a simple Select * SET rsListe = Server.CreateObject("ADOdb.RecordSet")strSQL = "select * from tblAdressen "rsListe.Open strSQL, nameConn, adOpenStaticfrom say a table with following components:surnamevornamestreettownIf I try to call vorname before surname nothing appears but if I follow the order that the components of the table are listed then everything is fine.Can anyone explain whats going on???Thanks in advance
Link to comment
Share on other sites

Can you post the code you're using?
Have discovered since yesterday that this only happens on an inner join. Here for example:SET rsListe = Server.CreateObject("ADOdb.RecordSet")strSQL = "select tblAdressen.*, tblLand.* "strSQL = strSQL&" FROM tblLand INNER JOIN tblAdressen ON tblLand.landId = tblAdressen.landId "strSQL = strSQL&" where adressenId="&intAdressenIdrsListe.Open strSQL, nameConn,adOpenStaticHere is the order of the fields in the table. intType= rsListe("Type")strfirma1= rsListe("firma1")strFirma2= rsListe("Firma2")strNachname= rsListe("Nachname")strBranche= rsListe("Branche")intKundenNr= rsListe("KundenNr")intZaehler= rsListe("Zaehler")strKunde= rsListe("Kunde")strWerkstatt= rsListe("Werkstatt")strBieter= rsListe("Bieter")strVersicherung= rsListe("Versicherung")strRechtsanwalt= rsListe("Rechtsanwalt")strAktiv= rsListe("Aktiv")strTyp= rsListe("Typ")strAnrede= rsListe("Anrede")strVorname= rsListe("Vorname")strStrasse1= rsListe("Strasse1")strStrasse2= rsListe("Strasse2")strPlz= rsListe("Plz")strOrt= rsListe("Ort")strTelPriv= rsListe("TelPriv")strTelGes= rsListe("TelGes")strFax= rsListe("Fax")strHandy= rsListe("Handy")strEmail= rsListe("Email")strBemerkung= rsListe("Bemerkung")strSteuer= rsListe("Steuer")intLand= rsListe("LandId")strLand= rsListe("land")response.write strLand & "strland<br>"response.write intLandId & "intland<br>"<%while not rsListe.eof %><%=strFirma1%><%=strFirma2%><%rsListe.MoveNextwend%>As soon as I swap strFirma1 for strFirma2 then strFirma1 is nowhere to be seen.
Link to comment
Share on other sites

If that is your complete code, then you're not getting the values in the loop. You're getting the values for the first row only, then looping and printing out those same values every time. You should be updating the values in the loop. It's also better to use this syntax to get the value of a field:rs.fields.item("field_name").value

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...