hi,
i tried to migrate my database in access to sql server 2000,
at first i though it was working ok... but when i tried to query using RECORDCOUNT, it value returned -1.... but i tried it in ACCESS but its value is 1... is there such thing as recordcount = -1? is this an error? is there any alternatives? my sample code is this:
VB Code:
  1. Set rs = New ADODB.Recordset
  2. rs.Open "Select * from contacts where accountnum= '" & Trim(txtmain.Text) & "' or phone= '" & Trim(txtmain.Text) & "'", conn, 1, 3
  3. MsgBox rs.RecordCount
  4. If rs.RecordCount <> 0 Then
  5. lblerr.Visible = False
  6.    
  7.    If Len(Trim(rs!Company)) <> 0 Then
  8.    Me.txtcomp.Text = rs!Company
  9.    Else
  10.    Me.txtcomp.Text = "N.A."
  11.    End If
  12.    
  13.    If Len(Trim(rs!Title)) <> 0 Then
  14.    Me.txttit.Text = rs!Title
  15.    Else
  16.    Me.txttit.Text = "N.A."
  17.    End If
  18.    
  19.    If Len(Trim(rs!Contact)) <> 0 Then
  20.    Me.txtcontact.Text = rs!Contact
  21.    Else
  22.    txtcontact.Text = "N.A."
  23.    End If
  24.    
  25.    If Len(Trim(rs!Department)) <> 0 Then
  26.    Me.txtdept.Text = rs!Department
  27.    Else
  28.    txtdept.Text = "N.A."
  29.    End If
  30.    
  31.    If Len(Trim(rs!mobnum)) <> 0 Then
  32.    Me.txtmobnum.Text = rs!mobnum
  33.    Else
  34.    txtmobnum.Text = "N.A."
  35.    End If
  36.    
  37.    
  38.    If Len(Trim(rs!Email)) <> 0 Then
  39.    Me.txtemail.Text = rs!Email
  40.    Else
  41.    txtemail.Text = "N.A."
  42.    End If
  43.  
  44.    If Len(Trim(rs!Phone)) <> 0 Then
  45.    txtconnum.Text = rs!Phone
  46.    Else
  47.    txtconnum.Text = "N.A."
  48.    End If
  49.    
  50.    If Len(Trim(rs!extension)) <> 0 Then
  51.    txtextension.Text = rs!extension
  52.    Else
  53.    txtextension.Text = "N.A."
  54.    End If
  55.    
  56.    If Len(Trim(rs!contactstat)) <> 0 Then
  57.    txtidstat.Text = rs!contactstat
  58.    Else
  59.    txtidstat.Text = "N.A."
  60.    End If
  61.    
  62.    If Len(Trim(rs!website)) <> 0 Then
  63.    txtwebsite.Text = rs!website
  64.    Else
  65.    txtwebsite.Text = "N.A."
  66.    End If
  67.    
  68.    If Len(Trim(rs!accountnum)) <> 0 Then
  69.    txtaccountnum.Text = rs!accountnum
  70.    Else
  71.    txtaccountnum.Text = "N.A."
  72.    End If
  73.    
  74.    If Len(Trim(rs!recordmanager)) <> 0 Then
  75.    txtam.Text = rs!recordmanager
  76.    Else
  77.    txtam.Text = "Ronald San Diego"
  78.    End If
  79.    
  80. Else
  81. lblerr.Visible = True
  82. End If
  83. rs.Close
  84. Set rs = Nothing