Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 update db using mysqlcommand

Author  Topic 

rogevill87
Starting Member

5 Posts

Posted - 2012-01-27 : 09:20:07
do nothing because im using textbox to input data to my database
'cmd = New MySqlCommand("Update user_account set (username,pass,sign_as) values('" + txtcreate_username.Text + "', '" + txtcreate_pass.Text + "','" + cmb_reg.Text + "')where username = 'txtupdate.text'", conn)

running because data is specified in the code
cmd = New MySqlCommand("update user_account set username = 'rogelio' where id = '1'", conn)

question? hw can i update my database using txtbox pls help tnx

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-01-27 : 09:47:32
We are on Microsoft SQL Server and not MySQL.

Maybe you can get better help here: http://www.dbforums.com/mysql/


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-27 : 10:44:52
whats the data coming from textbox?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

rogevill87
Starting Member

5 Posts

Posted - 2012-01-27 : 20:05:57
data to be updated...what ever data i input in txtbox my database will be update...
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-28 : 17:45:47
ok..but do you know what record you need to update against? firing an open update query results in all rows of table getting updated

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2012-01-29 : 12:16:25
I think:

where username = 'txtupdate.text'

will cover that Visakh - although the syntax looks wrong, I think it should be:

'cmd = New MySqlCommand("Update user_account set (username,pass,sign_as) values('" + txtcreate_username.Text + "', '" + txtcreate_pass.Text + "','" + cmb_reg.Text + "')where username = '" + txtupdate.text + "'", conn)

I'm presuming this syntax is OK in MySQL?

UPDATE MyTable
SET (Col1, Col2, Col3) VALUES ('Value1','Value2','Value3')
WHERE ...

??
More normally the syntax is


UPDATE MyTable
SET Col1 = 'Value1',
Col2 = 'Value2',
Col3 = 'Value3'

WHERE ...
Go to Top of Page
   

- Advertisement -