ASP.NET access with MySQL, How to use a Gridview just to show the data....

Trying to get ASP.NET capabilities for mySQL.  (I know, toooo simple)

I have a project in VS 2013, web form.

I have added the reference for the mySQL .NET Connector DLL  (MySql.Data).  
Created a mySQ-test.aspx file, very simple.  Div with a GridView in it.
Using the Intellisense for the GridView, I build the DataSource using a SqlDataSource, which is ADO.NET version.  
Input the connection information and test xconnection.  all is FINE at this point.

I get the part of picking the table to use, and I chose one with about 30 records.  I basic field.  So, I build the query and it shows --- SELECT [markets_name] FROM [markets]

Try to test it and get a message that VS dont like it....   See attched file...

Syntax is easy, usable,  what is my problem?   FYI, pretty new to VS2013, as been on 2008 for looooooong time.  But that should make no difference.

Bob
vs2013-error.jpg
Cork1954Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Dan CraciunConnect With a Mentor IT ConsultantCommented:
I'm not a .NET developer, but this page seems to have a nice tutorial on using MySQL with C#: http://zetcode.com/db/mysqlcsharptutorial/
0
 
Dan CraciunConnect With a Mentor IT ConsultantCommented:
Try
SELECT markets_name FROM markets

MySQL does not use [] to qualify table/field names.

If you need qualifiers, use

SELECT `markets_name` FROM `markets`

HTH,
Dan
0
 
Cork1954Author Commented:
see, knew it was easy.  Sooooo, it is impossible to test mySQL thru the Intllisense module without being a qizrd to remove those.  It builds it that way and not editable.  

Hate to expand here.  How would I accomplish this programmatically in the code (C#)?
Kinda fuzzy here...

set up connectionString from Web.config  (mySqlConnectionString)

Set up your SQLSelect string = "SELECT marketsname FROM markets"

Set up my SqlDataSource args = new SqlDataSource(connectionString, SQLSelect)

Make my  "GridView gv1_markets = dataSource.Select(args);

then I get lost...
0
 
Cork1954Author Commented:
Great,  even tho link was focused on ubuntu in parts, your answer gave me what looks like the solution.   Thanx!
0
 
Dan CraciunIT ConsultantCommented:
You're welcome.
Glad I could help!
0
All Courses

From novice to tech pro — start learning today.