This article is a mirror article of machine translation, please click here to jump to the original article.

View: 14363|Reply: 2

[New Issue] How to call the MYSQL class

[Copy link]
Posted on 9/28/2018 7:27:40 PM | | |
winform window program

In the database, there are name and pass
                         123          abc
How WinForm reads this ABC into a textbox

MySQLConn con = new MySQLConn();
            string sql = "select * from user where name='123'";
            dataGridView1.DataSource  = con. ExecuteQuery(sql);

I wrote this wrong
MySQLConn con = new MySQLConn();
            string sql = "select * from user where name='123'";
            textbox1  = con. ExecuteQuery(sql);




Previous:How Docker containers and hosts copy files to each other
Next:Fiddler4 plugin development tutorial
Posted on 9/29/2018 9:23:03 AM |
The ExecuteQuery method is in java jdbc

According to your previous code, if you execute the ExecuteQuery method, it should return a DataTable

So, the code is changed to:

textbox1. Text  = con. ExecuteQuery(sql). Rows[0]["pass"]. ToString(); Try

Posted on 11/2/2018 8:58:43 AM |
We recommend using Dapper and Dapper's SimpleCURD
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com