Solved

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

Posted on 2014-04-23
5
715 Views
Last Modified: 2014-04-23
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
0
Comment
Question by:Cork1954
  • 3
  • 2
5 Comments
 
LVL 34

Assisted Solution

by:Dan Craciun
Dan Craciun earned 500 total points
ID: 40018043
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
 

Author Comment

by:Cork1954
ID: 40018099
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
 
LVL 34

Accepted Solution

by:
Dan Craciun earned 500 total points
ID: 40018113
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
 

Author Comment

by:Cork1954
ID: 40018216
Great,  even tho link was focused on ubuntu in parts, your answer gave me what looks like the solution.   Thanx!
0
 
LVL 34

Expert Comment

by:Dan Craciun
ID: 40018223
You're welcome.
Glad I could help!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Amazon Redshift 2 37
Where did System.Data.Objects go? 2 40
Help needed with Powershell  XML to MySQL 5 59
Present Absent from working date rage 11 35
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question