|
-
Mar 26th, 2008, 04:12 PM
#1
Thread Starter
Hyperactive Member
[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!
-
Mar 26th, 2008, 04:26 PM
#2
Re: Is It That Difficult!?
 Originally Posted by Anjari
I get an error??
Would you like us to make random guesses as to what the error might be?
-
Mar 26th, 2008, 04:56 PM
#3
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
-
Mar 26th, 2008, 08:30 PM
#4
Thread Starter
Hyperactive Member
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
-
Mar 26th, 2008, 09:58 PM
#5
Thread Starter
Hyperactive Member
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.
-
Mar 27th, 2008, 03:35 AM
#6
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?
-
Mar 27th, 2008, 09:13 AM
#7
Thread Starter
Hyperactive Member
Re: [RESOLVED] Is It That Difficult!?
-
Mar 27th, 2008, 02:26 PM
#8
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|