| | |
Update query not working in VB.NET
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
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 |
"crystal .net .net2005 30minutes 2005 2008 access account arithmetic array basic binary bing button buttons center check code combobox component connectionstring crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dosconsolevb.net dropdownlist excel file-dialog folder ftp generatetags google gridview hardcopy image images insert intel internet login math mobile monitor ms navigate net networking opacity output passingparameters peertopeervideostreaming picturebox picturebox1 port print problem problemwithinstallation project reports" save savedialog searchbox searchvb.net select serial soap string table tcp text textbox timer toolbox trim update updown user usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web wpf






