Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[C#][VB.NET] MySQL Example
#1
Just a basic example for connecting to your online database. Shouldn't be hard to convert C# to VB.NET.

Code:
using MySql.Data.MySqlClient;

MySqlConnectionStringBuilder conString = new MySqlConnectionStringBuilder();
conString.Server = "server/host here";
conString.Database = "database here";
conString.UserID = "username here";
conString.Password = "password here";

MySqlConnection con = new MySqlConnection(conString.ToString());
MySqlCommand cmd = con.CreateCommand();

try
{
con.Open();
MessageBox.Show("Connected");
}
catch
{
MessageBox.Show("Cannot connect");
}
Reply
#2
Why not go post here : http://www.supportforums.net/forumdisplay.php?fid=20 ??
[Image: BKlNU.png]

---------
Reply
#3
(07-01-2012, 05:46 PM)HF~Legend Wrote: Why not go post here : http://www.supportforums.net/forumdisplay.php?fid=20 ??

That's C++ and this is C#.
Reply
#4
(07-01-2012, 06:37 PM)AceInfinity Wrote: That's C++ and this is C#.


Just for that ? Put a code (C#) in Visual basic... I'm crazy or ??
[Image: BKlNU.png]

---------
Reply
#5
(07-02-2012, 09:14 AM)HF~Legend Wrote: Just for that ? Put a code (C#) in Visual basic... I'm crazy or ??

I don't know what you're trying to point out here....

You pointed towards a C++ forum, and now you're referencing C#/VB? Unsure

Yes C#/VB can be easily converted, but you can't put C# code directly into VB... Conversions still have to be made.
Reply
#6
(07-02-2012, 09:14 AM)HF~Legend Wrote: Just for that ? Put a code (C#) in Visual basic... I'm crazy or ??

I do not see C# subforum around here, so why not post in here? It is part of the .NET Framework and it's not hard to convert C# to VB.NET

Blackhat
Reply
#7
(07-02-2012, 06:00 PM)Mercury Wrote: I do not see C# subforum around here, so why not post in here? It is part of the .NET Framework and it's not hard to convert C# to VB.NET

Blackhat

Exactly, read the forum title: "Visual Basic and the .NET Framework"

VB & C# are traditionally Microsoft languages built around the .NET Framework. The other forum is specifically for C++ programming. And C++ doesn't have to be .NET.
Reply
#8
Just a note if your connecting to a SQL database your better off just creating a httpwebrequest to a page and letting PHP handle the connection so your database information will be much safer
Reply
#9
(07-19-2012, 09:38 AM)Sutton2k9 Wrote: Just a note if your connecting to a SQL database your better off just creating a httpwebrequest to a page and letting PHP handle the connection so your database information will be much safer

[Image: 678516f32180ecc8da2dc286bc4362af.png]

Converting code isnt that hard, i'll post a few links to converters once i get ten posts and this limit is removed
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [VB.Net] MySQL connection class [Register/List/Login] The-One 21 11,554 07-20-2011, 09:33 AM
Last Post: PURP
  VB.NET MySql , Help please booterphhp 0 620 12-12-2010, 04:58 PM
Last Post: booterphhp

Forum Jump:


Users browsing this thread: 1 Guest(s)