| | |
Update query not working in VB.NET
![]() |
•
•
Join Date: Apr 2009
Posts: 4
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: 4
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
Views: 902 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access ado.net application array arrays basic bindingsource browser c# center checkbox client code combobox communication connection control convert crystal crystalreport data database datagrid datagridview dataset datatable date datetimepicker design designer dissertation dissertations error excel file filter form gridview image images insert listview login loops mobile ms msaccess net objects openxml path picturebox port print printing problem read save search security serial server settings sms socket sorting sql statement studio syntax tagging tags textbox time timer type update upload user validation vb vb.net vb2008 view visual visual-studio visualbasic visualbasic.net visualstudio2008 vs2008 web webbrowser windows winforms wpf xml






