| | |
Update query not working in VB.NET
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Apr 2009
Posts: 3
Reputation:
Solved Threads: 0
Hi all,
Well I am new here in Daniweb. First of all hi to all. I have a small problem but it takes me so long to find out its solution but still no use. Actually I am writing an update query in my vb.net page for my website. Here is the query:
UPDATE mainadmin SET firstname = 'abc', lastname = 'xyz', passvord = 'mypassword' WHERE username='xyz@hotmail.com'
Question is when i write like this then it enter these above values and no problem, but when I take values from textboxes then it gives me error, simply dont take the values. Here is what I am writing:
UPDATE mainadmin SET firstname = ' "&txt1.text&" ', lastname = ' "&txt2.text&" ', passvord = ' "&txt3.text&" ' WHERE username=' xyz@hotmail.com '
This query wont works. Anybody can help me how we can make this query workable. I'll appreciate reply and thaks in advance.
/Ahmed
Well I am new here in Daniweb. First of all hi to all. I have a small problem but it takes me so long to find out its solution but still no use. Actually I am writing an update query in my vb.net page for my website. Here is the query:
UPDATE mainadmin SET firstname = 'abc', lastname = 'xyz', passvord = 'mypassword' WHERE username='xyz@hotmail.com'
Question is when i write like this then it enter these above values and no problem, but when I take values from textboxes then it gives me error, simply dont take the values. Here is what I am writing:
UPDATE mainadmin SET firstname = ' "&txt1.text&" ', lastname = ' "&txt2.text&" ', passvord = ' "&txt3.text&" ' WHERE username=' xyz@hotmail.com '
This query wont works. Anybody can help me how we can make this query workable. I'll appreciate reply and thaks in advance.
/Ahmed
•
•
Join Date: Apr 2009
Posts: 1
Reputation:
Solved Threads: 0
Daer Friend
old codings
UPDATE mainadmin SET firstname = ' "&txt1.text&" ', lastname = ' "&txt2.text&" ', passvord = ' "&txt3.text&" ' WHERE username=' xyz@hotmail.com '
new Codings
UPDATE mainadmin SET firstname = ' "& txt1.text &" ', lastname = ' "& txt2.text &" ', passvord = ' "& txt3.text &" ' WHERE username=' xyz@hotmail.com '
old codings
UPDATE mainadmin SET firstname = ' "&txt1.text&" ', lastname = ' "&txt2.text&" ', passvord = ' "&txt3.text&" ' WHERE username=' xyz@hotmail.com '
new Codings
UPDATE mainadmin SET firstname = ' "& txt1.text &" ', lastname = ' "& txt2.text &" ', passvord = ' "& txt3.text &" ' WHERE username=' xyz@hotmail.com '
•
•
Join Date: Mar 2009
Posts: 5
Reputation:
Solved Threads: 2
Daer Friend
old codings
UPDATE mainadmin SET firstname = ' "&txt1.text&" ', lastname = ' "&txt2.text&" ', passvord = ' "&txt3.text&" ' WHERE username=' xyz@hotmail.com '
new Codings
UPDATE mainadmin SET firstname = '"& txt1.text &"' , lastname = '"& txt2.text & "' , passvord = '"& txt3.text &"' WHERE username= 'xyz@hotmail.com'
Remember DON'T put space B/W ' & "
old codings
UPDATE mainadmin SET firstname = ' "&txt1.text&" ', lastname = ' "&txt2.text&" ', passvord = ' "&txt3.text&" ' WHERE username=' xyz@hotmail.com '
new Codings
UPDATE mainadmin SET firstname = '"& txt1.text &"' , lastname = '"& txt2.text & "' , passvord = '"& txt3.text &"' WHERE username= 'xyz@hotmail.com'
Remember DON'T put space B/W ' & "
•
•
Join Date: Apr 2009
Posts: 3
Reputation:
Solved Threads: 0
Hi Guys,
After some my efforts and thinking on the query i make it workable. Its running now properly. What the problem was, I was not converting '"& txt.text & "' to String type. This text box has string value but query was not taking it as string in VB.NET and we need to manually convert it to string type with CStr() function.
Well its working now. By the way thanks for your initial replies.
Regards
/Ahmed
After some my efforts and thinking on the query i make it workable. Its running now properly. What the problem was, I was not converting '"& txt.text & "' to String type. This text box has string value but query was not taking it as string in VB.NET and we need to manually convert it to string type with CStr() function.
Well its working now. By the way thanks for your initial replies.
Regards
/Ahmed
![]() |
Similar Threads
- Friends request in PHP (PHP)
- problem with text box....... (C#)
- hibernate (Java)
- Help with automatic update problem and more (Viruses, Spyware and other Nasties)
- Queryable Collections (ASP.NET)
- DB and :Net questions (VB.NET)
- HOWTO: Run a Query on a Database using ODBC and return all Results into a DGV Object (C#)
- how do i update to Access db? (C#)
- Highjack file Ie wont download (Viruses, Spyware and other Nasties)
- Internet Explorer will not download (Web Browsers)
Other Threads in the VB.NET Forum
- Previous Thread: I want to manipulate the registry key values through a vb.net application
- Next Thread: Writing to Access database using VB.net
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account application array basic beginner browser button buttons center check click code combo crystalreport cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic dropdownlist excel exists fade file-dialog filter forms ftp generatetags hardcopy html images input insert intel listview module monitor net networking number open output panel passingparameters picturebox picturebox2 port print printing problem project regex right-to-left searchvb.net select serial settings shutdown socket sqldatbase sqlserver survey tcp temperature text textbox timespan toolbox transparency trim txttoxmlconverter user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year






