Jump to content

Recommended Posts

Hello guys!

 

I just wanted to know what are the advantages of VB.net over VB and/or vice versa....

 

Another question:

if in php we can do this:

<PHP?

$sql = "SELECT product_id, product_name, product_description FROM products ORDER BY product_name";

$res = mysql_query($sql);

while ($row = mysql_fetch_array($res)) {

    print "<tr>

          <td><a href='product.php?product_id=$row[0]'>$row[1]</a></td>

          <td>$row[2]</td>

    </tr>";

}

?>

 

how can i do it with vb/vb.net? i've heard that i can use the datagrid. but i dont know how to do it.

thnx for any help guys.

more power to you all.

Link to comment
https://forums.phpfreaks.com/topic/117185-vb-vs-vbnet/
Share on other sites

Uh isn't Visual Basic.NET just Visual Basic with the .NET framework?  So, it would go something like this:

 

VB:

-No dependency on .NET framework (certain versions, having to have it at all, so on)

 

VB.NET:

-Uhhh to be honest, I've never used the .NET framework, but being a framework, I would assume it has code already written and what not.

 

 

Uhmmm I've connected to MySQL through C++ and Java before, but I've never coded a single thing in Visual Basic (that's right -- I'm making all this up as I go ;p).  Anyway, I Googled, and this should get you started:

 

http://www.base64.co.uk/mysql-odbc-driver/

http://www.vbmysql.com/articles/vbnet-mysql

http://www.mysql.com/products/connector/odbc/

 

Bleh, just google "Visual Basic MySQL"

Link to comment
https://forums.phpfreaks.com/topic/117185-vb-vs-vbnet/#findComment-602861
Share on other sites

  • 4 weeks later...

I'd say VB is old...er school. I was working with it back in 2001-ish. The nice thing about .net is that it's all managed. But the down side is that you don't get the control like you would in C/C++

 

Me, I like to program in VB .net because I know just about all Vista and XP SP3 machines should be able to run the program. I'd like to learn C\C++ but my college doesn't offer it (well the only one I can afford) and I cannt find a good solid starting point on the web, which is where I learn best.

 

As for your php code, are you wanting to dump it into a Data Grid, Listview, Listbox? There is a good video series on databases. The guy is boring but he makes things easy to under stand. Here's the links to the vidoes:

 

Look for "Forms over Data Video Series"

http://msdn.microsoft.com/en-us/vbasic/bb466226.aspx

 

With the ADO.NET connector you can even access mysql databases. Nice if you want a Web/Windows type app

 

http://dev.mysql.com/downloads/connector/net/1.0.html

Link to comment
https://forums.phpfreaks.com/topic/117185-vb-vs-vbnet/#findComment-625218
Share on other sites

  • 10 months later...

My .NET isn't very good, since I'm still learning it, but to emulate typical PHP firehose behavior, you simply need a command object and a data reader.

 

Here's some of my code.  It's C#, but it should give you an idea of what to do:

 

string query = "Select level, name, tpCost, dmgModifier, hitPenalty from DBHackerAttacks";

using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["GitSConnectionString1"].ConnectionString))
{
   SqlCommand cmd;
   SqlDataReader reader;

   cmd = new SqlCommand(query, conn);
   conn.Open();

   reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);

   while (reader.Read())
   {
      HackerAttack hackerAttack = new HackerAttack(reader.GetInt32(0), reader.GetString(1), reader.GetInt32(2), reader.GetDouble(3), reader.GetDouble(4));
      this.attacks.Add(hackerAttack.Level, hackerAttack);
   }
}

 

This is .NET 3.5, so some of the things may need to be tweaked.  It uses ADO.NET, so you'll need to ensure the proper namespaces are included.

 

With your example, you could either dynamically build a table/other structure, and fill in its cells in the while-loop, or you could pre-make the table/other structure in the plain .aspx file, and, once again, fill its cells with data in the loop.

Link to comment
https://forums.phpfreaks.com/topic/117185-vb-vs-vbnet/#findComment-882329
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.