Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,615 members, 7,809,259 topics. Date: Friday, 26 April 2024 at 06:55 AM

Need Help At Translating Php To Vb.net - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Need Help At Translating Php To Vb.net (1233 Views)

Converting .php To .exe / Convert Code From Php To Vb.net / Post Ur Vb 6.0 Questions Here (2) (3) (4)

(1) (Reply)

Need Help At Translating Php To Vb.net by lordlasse1: 8:23pm On May 08, 2011
Hey guys, i need to translate a code from php to vb.net, but i still can't do it sad
so maybe one of you can help me ?
heres the php script :

<?php
/*
|-------------------------------------------------------------------
| Database Connection Details
|-------------------------------------------------------------------
*/
$mysql_host = "5.48.112.100";
$mysql_user = "root";
$mysql_pass = "TheShorty";
$mysql_db = "account";
/*
|-------------------------------------------------------------------
| Connect with Database
|-------------------------------------------------------------------
*/
mysql_connect($mysql_host, $mysql_user, $mysql_pass) OR
die("Es konnte keine Verbindung zur Datenbank hergestellt werden.
Fehlermeldung: ".mysql_error());

mysql_select_db($mysql_db) OR
die("Die Datenbank konnte nicht benutzt werden.
Fehlermeldung: ".mysql_error());
Re: Need Help At Translating Php To Vb.net by dellnet: 3:07am On May 15, 2011
import System
import System.Data

import MySql.Data
import MySql.Data.MySqlClient

Public void mysqlconnection()
{
Dim connStr = _
"server=5.48.112.100;user=root;database=account;port=3306;password=TheShorty;"
Dim conn as MySqlConnection = new MySqlConnection(connStr)
Dim sql as string =""
try
{
conn.Open() 'equivalent to mysql_connect($mysql_host, $mysql_user, $mysql_pass)
'mysql_select_db($mysql_db)
'at this point you have already selected the db, just go ahead sql query;
sql = "SELECT * FROM table"
Dim cmd as MYSqlCommand = new MYSqlCommand(sql,conn)
Dim rdr as MYsqlDataReader = cmd.ExecuteReader()

while(rdr.Read())
{
System.Diagnosics.Debug.Print("1st column value in db:" + rdr(0))
}
rdr.close()
}
catch(ex as Exception)
{
MessageBox(ex.message.tostring())
}
conn.Close()

}


Download connector from http://dev.mysql.com/downloads/connector/net/
install and call this code from anywhere in your code.
Re: Need Help At Translating Php To Vb.net by Seun(m): 1:05pm On May 20, 2011
You're using PHP scripts as a programming guide? Ookay.

(1) (Reply)

It Incubation Centres: Expect New Generation Of Software Entreprenuers, Johnson / What Every DBA Needs To Know About The New Mysql 5.7! / Time Spent Online: Nairaland

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 7
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.