Results 1 to 8 of 8

Thread: [RESOLVED] Is It That Difficult!?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    Canton, GA
    Posts
    487

    Resolved [RESOLVED] Is It That Difficult!?

    Using ASP.NET with an access DB - (I didnt pick the database!!)

    I have a formview1 on my page with databound textboxes... All I need to know is how in gods name do I update my records?? It seems when I attempt to use the following:

    dsLeads.UpdateCommand = "UPDATE MYtable SET MyColumn = '" & txtFirstName.Text & "' WHERE ID = txtID.Text

    I get an error?? Why cant I find the value of txtFirstName.Text from a Fromview??

    PLEASE SOMEONE HELP!

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Is It That Difficult!?

    Quote Originally Posted by Anjari
    I get an error??
    Would you like us to make random guesses as to what the error might be?

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Is It That Difficult!?

    you opened your string.... started the command... added the tick, closed the string... added the contents of the text box, re-opened the string, added the closing tick mark, and started your where clause. things go south right after your equals sign.... where you included another text box contents.... BUT you didn't close the string off and append the text box contents.... so your SQL took it as a litteral and your where clause now looks like this:
    "WHERE ID = txtID.Text" .... and to further compound the issue, you still didn't close off the string...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    Canton, GA
    Posts
    487

    Re: Is It That Difficult!?

    ugh, the wife was rushing me out the door....

    Here is the way it really looks:

    dsLeads.UpdateCommand = "UPDATE MYtable SET MyColumn = ' " & txtFirstName.Text & " ' WHERE ID = ' " & ID.Text & " ' "

    The error is a generic error - I wish I could say it shed some light on what I was doing wrong but all it tells me is there was an error in my dsLEads.BindData() command.

    So to be honest Medhack yea help me guess

    Can someone help me fix the string??

    Thanks!

    Anjari

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    Canton, GA
    Posts
    487

    Re: Is It That Difficult!?

    Note to self: go to asp.net and watch the Fromview / Gridview tutorial.

    Please form a double line to slap me.

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [RESOLVED] Is It That Difficult!?

    It was... let me guess... object reference not set?

    Anything at all would have given a clue... so this means that you were trying to access a control in a formview directly, and txtFirstName.Text was the markup ID rather than codebehind?

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    Canton, GA
    Posts
    487

    Re: [RESOLVED] Is It That Difficult!?

    Exactly...

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [RESOLVED] Is It That Difficult!?

    See, told you it wasn't generic.

    Every error, no matter what you think, is of some significance. When shown along with the code of course.

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