Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2003
    Posts
    9

    Unanswered: question on sql statement using VB

    hi,

    i am beginner ..using VB


    i have this questions

    Private Sub Command1_Click()
    Dim rs As New ADODB.Recordset

    With rs

    .CursorLocation = adUseClient

    .CursorType = adOpenKeyset

    .LockType = adLockOptimistic

    .CacheSize = 50

    ' WHAT COULD COULD BE ERROR IN BELOW STATEMENT

    .Source = "update reservation set startdate = '" + Text1.Text + "' where reservationid= " + Label5.Caption + ""
    >>>>>>>>>>>>


    i want to delete a hotel row in hotel table using hotel phone no(primary key)......

    but it is a foreign key used in another table...

    first i have to delete the rows in the another table which contains foreign keys of this table...

    then i want to delete the row in the hotel table ..which contains required phone no...

    pls tell me how i have to write source statement for this...using VB

    THANX...BYE

  2. #2
    Join Date
    Nov 2003
    Posts
    76
    I assume you have a connection open for recordset.

    strSql= "update reservation set startdate = " & Text1.Text & " where reservationid= " & Label5.Caption

    use rs.open (strSql) instead of rs.Source(strSql)

  3. #3
    Join Date
    Nov 2003
    Posts
    9

    hi ..i am getting this error..how to deal with

    hi,

    thanx ...i have got a reply...but being new to this..how to deal with..i haven given code and my error response message...

    i am getting this error..

    user requested of cancel current operation..this is my code..

    which i am showing again



    Private Sub Command1_Click()
    Dim rs As New ADODB.Recordset

    With rs

    .CursorLocation = adUseClient

    .CursorType = adOpenKeyset

    .LockType = adLockOptimistic

    .CacheSize = 50

    .Source = "update reservation set roomnumber = " + Text1.Text + " where guest_f_name='" + Label1.Caption + "'"
    .ActiveConnection = "dsn=babbage;uid=shahfal;pwd=datacs425"

    .Open

    End With

    'rs.Close

    Set rs = Nothing
    End Sub


    could u help us..wat is the reasons for that kind..

    thanx..

  4. #4
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    Post hi

    sivaroo maild the wrote answer change the + into an &

    the message u get is probebly from your Network-operator who is controling the Database if he sees that a Query would take to long or is so complex that its slows up the network he can cancel it

  5. #5
    Join Date
    Jul 2003
    Location
    Amsterdam, Nederland
    Posts
    450

    Exclamation And

    Source = "update reservation set roomnumber = " & Text1.Text & " where guest_f_name LIKE'" & Label1.Caption & "'"


    so
    1. Change + in to &
    2. WHERE NAME LIKE "CHARLES"
    3. WHERE RoomNO = 3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •