Visual Studioでは2つの接続方法がある。


using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace WindowsFormsApplication1


public partial class Form1 : Form


private ADODB.Connection cn = new ADODB.Connection();

private ADODB.Recordset rs = new ADODB.Recordset();

private string cnStr;

private string query;

public Form1()




private void button1_Click(object sender, EventArgs e)


cnStr = “DRIVER={MySQL ODBC 5.1 Driver};”

+ “SERVER=;”

+ “PORT=3306;”

+ “DATABASE=totalization;”

+ “UID=admin;”

+ “PASSWORD=aaaaaaaa;”;

query = “SELECT value FROM test”;

cn.Open(cnStr, null, null, 0);

rs.Open(query, cn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic, -1);



while (rs.EOF == false)


listBox1.Items.Add( rs.Fields[“value”].Value.ToString() );

// label1.Text = rs.Fields[“value”].Value.ToString();






private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)







そのあとは.net frameworkのライブラリで




カテゴリー: C#, IT、PC環境, MYSQL, PC環境 タグ: ,
MYSQLへ、VisualStudioで接続する方法” への1件のコメント
  1. I was wondering if you ever considered changing the layout of your blog? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having one or two images. Maybe you could space it out better?

  2. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work.

  3. pretty practical stuff, overall I imagine this is really worth a bookmark, thanks

  4. I would like to point out my passion for your generosity giving support to men and women that need assistance with this particular issue. Your personal commitment to getting the solution all over became remarkably productive and has without exception allowed men and women much like me to realize their desired goals. Your personal valuable report signifies a whole lot a person like me and far more to my office colleagues. Best wishes; from each one of us.

  5. You created some excellent points there. I did a search on the topic and discovered a lot of people will agree together with your blog.

  6. Superb read, I just passed this onto a friend who was doing a little study on that. And he actually bought me lunch because I found it for him smile So let me rephrase that: Thanks for lunch!

  7. What are you indicating, man? I recognize everyones got their own view, but really? Listen, your website is neat. I like the energy you put into it, specifically with the vids and the pics. But, come on. Theres gotta be a better way to say this, a way that doesnt make it seem like everybody here is stupid!

  8. sex dates より:

    Your current article continually have got many of really up to date info. Where do you come up with this? Just saying you are very innovative. Thanks again

  9. Outsourced IT より:

    It’s not that I want to replicate your web-site, but I really like the layout. Could you tell me which design are you using? Or was it tailor made?

  10. I was suggested this internet website by my cousin. I’m not confident whether this post is written by him as nobody else know such detailed about my dilemma. You are incredible! Thanks!

  11. you’ve gotten an essential weblog appropriate here! would you wish to make some invite posts on my weblog?

  12. I’ve been recently wondering about the identical issue personally lately. Pleased to see another person on the same wavelength! Nice article.

  13. HP Blackmarket より:

    I don’t even know how I ended up here, but I thought this post was good. I do not know who you are but certainly you’re going to a famous blogger if you are not already 😉 Cheers!

  14. Cartomizers より:

    I hope you never stop! This is one of the best blogs Ive ever read. Youve got some mad skill here, man. I just hope that you dont lose your style because youre definitely one of the coolest bloggers out there. Please keep it up because the internet needs someone like you spreading the word.

  15. Music より:

    Chaga mushroom coffee been lately brought to lots of everything about simply because with the Ukrainian article author Alexandr Solzhenitsyn by it is new ‘Cancer Ward’ in which traditional qualities is typically cured of a tumors on the help consume. Siberian Chaga

  16. Copify より:

    I would like to thank you for the efforts you have put in writing this blog. I really hope to check out the same high-grade blog posts from you in the future as well. In truth, your creative writing abilities has inspired me to get my own website now

  17. Thank you sharing such informative weblog to us. I never see or heard about this insects. I adore to watch national geographic, discovery channel because it shows the most amazing and beautiful animals and insects which we never saw in our entire life. Here, in this as effectively you share these insects which I never saw anyplace and its life cycle. I love this blog. Thank you once once again for sharing this weblog with us. Please maintain on sharing such informative issues in coming days as properly. Cheers

  18. より:

    MYSQLへ、VisualStudioで接続する方法 | 小俣泰明ブログ:株式会社トライフォート共同代表 MYSQLへ、VisualStudioで接続する方法 | 小俣泰明ブログ:株式会社トライフォート共同代表

1 Ping/トラックバック のために "MYSQLへ、VisualStudioで接続する方法"
  1. led grow lights より:

    News info

    I was reading the news and I saw this really interesting information