Results 1 to 8 of 8

Thread: update databse question

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Posts
    13

    update databse question

    okay i'm really sorry for asking so many questions but it would be really great if some one could tell me or give me an idea as to what i'm doing wrong. from what i can tell from the two books i'm looking through this should work to update my database but it isn't. any suggestions would be great please.

    Private Sub CmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdCancel.Click
    End
    End Sub

    Private Sub FrmRegister_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    OleDbDataAdapter1.Fill(Datasetup1)
    TxtUserName.Text = ""
    TxtPassWord.Text = ""
    TxtCity.Text = ""

    End Sub

    Private Sub CmdEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdEnter.Click
    If TxtUserName.Text = "" Then
    MessageBox.Show("Please Enter a User Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    Else
    If TxtPassWord.Text <> TxtConfirm.Text Then
    MessageBox.Show("Please check password(s) entered correctly", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand)
    Else
    If TxtCity.Text = "" Then
    MessageBox.Show("Please Enter a City", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand)
    Else
    End If
    Datasetup1.AcceptChanges()
    OleDbDataAdapter1.Update(Datasetup1)

    End If
    End If
    End Sub
    End Class

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Those text boxes are not bound to any datasource. Thats why it not updating.

    Also, you might want to ditch the DataSet and use a DataReader to insert values into the DB. It will be much faster.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Posts
    13
    the text boxes are bound from the properties menu. does that need to be done with code?
    thanks for the tip about the data reader i'll look into it.

  4. #4
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Ok, if all you are doing is inserting values from your register form, then you dont have to use a dataset or bound controls. Just write a select statement and insert into the db from the button click event. I post some code in the morning. I'm going to sleep now.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Posts
    13
    if you or some one else could post an example of how to do this it would be much appreciated. only examples i have found have been using a dataset and i've still had no luck getting the database to accept the text boxes information.

  6. #6
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Here ya go
    Attached Files Attached Files

  7. #7

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Posts
    13
    thank you very much

    you've been a great help to me

  8. #8
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    No prob.

Posting Permissions

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



Click Here to Expand Forum to Full Width