Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Colombo
RidhMathraa ’26 🎶✨
Tmadhusanka
Updated:
Wednesday at 11:58 PM
Ad icon
Colombo
PXN V10 Pro Direct Drive Racing Wheel (Under Warranty)
Abdur Rahman
Updated:
Wednesday at 10:23 PM
Ad icon
USDT ණය සේවාව - USDT Loan Service
පුරවැසියා
Updated:
Wednesday at 4:54 PM
Ad icon
🎮 INDIAN PSN GIFT CARDS AVAILABLE NOW! 🎮
madukaperera
Updated:
Tuesday at 12:57 PM
🚀 Google AI PRO – 18 Months | Rs. 850 Only
lkkolla
Updated:
Monday at 4:56 PM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Talk!
Amazing Visual C# Code
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="heshan123" data-source="post: 1726927" data-attributes="member: 15457"><p>OK guys here is the deal. I some of you are software engineers like me and most of the ppl are into IT in some form. So I believe a knowledge sharing system would be really nice since we have lot of members here. <img src="/styles/default/xenforo/smilies/default/wink.gif" class="smilie" loading="lazy" alt=";)" title="Wink ;)" data-shortname=";)" /> </p><p></p><p>OK I will start. This is Visual C# Code that I recently came up with to 'remotely' log into a MySQL database and access records. Its not copy right reserved or anything so feel free to make modifications to it if u like. Im fully open source. <img src="/styles/default/xenforo/smilies/default/D.gif" class="smilie" loading="lazy" alt=":D" title="Big grin :D" data-shortname=":D" /> <img src="/styles/default/xenforo/smilies/default/D.gif" class="smilie" loading="lazy" alt=":D" title="Big grin :D" data-shortname=":D" /> </p><p></p><p>Before u try this code u will have to download the mysql connector/net, it is located at: <a href="http://dev.mysql.com/downloads/connector/net/1.0.html" target="_blank">Click Here</a></p><p></p><p>Next add reference to: MySql.Data in your project</p><p></p><p>Next add "using MySql.Data.MySqlClient;" in your declaration section. </p><p></p><p>Try the code below.</p><p></p><p>[CODE]</p><p>private void button1_Click(object sender, System.EventArgs e)</p><p> {</p><p> string conPara = "SERVER=localhost;" +</p><p> "DATABASE=db1;" +</p><p> "UID=testuser;" +</p><p> "PASSWORD=testpassword;";</p><p> MySqlConnection connection = new MySqlConnection(conPara);</p><p> MySqlCommand statement = connection.CreateCommand();</p><p> MySqlDataReader Result;</p><p> statement.CommandText = "select * from customers";</p><p> connection.Open();</p><p> Result = statement.ExecuteReader();</p><p> while (Result.Read())</p><p> {</p><p> string thisrow = "";</p><p> for (int i= 0;i<Reader.FieldCount;i++)</p><p> thisrow+=Result.GetValue(i).ToString() + ",";</p><p> listBox1.Items.Add(thisrow);</p><p> }</p><p> connection.Close();</p><p> }[/CODE]</p><p></p><p>Ok that should connect you remotely to your MySQL Database and retrieve a record from the table named customers. If there are any questions pls post it here. I will try to answer. <img src="/styles/default/xenforo/smilies/default/wink.gif" class="smilie" loading="lazy" alt=";)" title="Wink ;)" data-shortname=";)" /> <img src="/styles/default/xenforo/smilies/default/wink.gif" class="smilie" loading="lazy" alt=";)" title="Wink ;)" data-shortname=";)" /></p></blockquote><p></p>
[QUOTE="heshan123, post: 1726927, member: 15457"] OK guys here is the deal. I some of you are software engineers like me and most of the ppl are into IT in some form. So I believe a knowledge sharing system would be really nice since we have lot of members here. ;) OK I will start. This is Visual C# Code that I recently came up with to 'remotely' log into a MySQL database and access records. Its not copy right reserved or anything so feel free to make modifications to it if u like. Im fully open source. :D :D Before u try this code u will have to download the mysql connector/net, it is located at: [URL="http://dev.mysql.com/downloads/connector/net/1.0.html"]Click Here[/URL] Next add reference to: MySql.Data in your project Next add "using MySql.Data.MySqlClient;" in your declaration section. Try the code below. [CODE] private void button1_Click(object sender, System.EventArgs e) { string conPara = "SERVER=localhost;" + "DATABASE=db1;" + "UID=testuser;" + "PASSWORD=testpassword;"; MySqlConnection connection = new MySqlConnection(conPara); MySqlCommand statement = connection.CreateCommand(); MySqlDataReader Result; statement.CommandText = "select * from customers"; connection.Open(); Result = statement.ExecuteReader(); while (Result.Read()) { string thisrow = ""; for (int i= 0;i<Reader.FieldCount;i++) thisrow+=Result.GetValue(i).ToString() + ","; listBox1.Items.Add(thisrow); } connection.Close(); }[/CODE] Ok that should connect you remotely to your MySQL Database and retrieve a record from the table named customers. If there are any questions pls post it here. I will try to answer. ;) ;) [/QUOTE]
Insert quotes…
Verification
Hath warak paha keeyada? (hatha wadikireema paha)
Post reply
Top
Bottom