Imports System.Data Imports System.Data.SqlClient Imports MySql.Data.MySqlClient Imports System Imports System.Data.OleDb Public Class WebForm1 Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent()
End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim myCon1 As New SqlConnection ("server=134.50.5.137;database=cis430sp05;user=iusr_cis430;password=microsoftisgood") Dim myCom1 As New SqlCommand("SELECT * FROM Products ORDER BY ProductID", myCon1) Dim myReader1 As SqlDataReader myCon1.Open () myReader1 = myCom1.ExecuteReader() While myReader1.Read() Response.Write(myReader1( "productID" ).ToString + "<br>") Response.Write(myReader1( "productName" ) + "<br>") Response.Write(myReader1( "productDesc" ) + "<br>" ) Response.Write("<img src='" + myReader1( "productpicurl" ) + "' /><br><br><br>" ) End While myCon1.Close() Response.Write( "<br>" ) Dim myCon2 As New MySqlConnection
Dim myCom2 As New MySqlCommand Dim myReader2 As MySqlDataReader myCon2.ConnectionString = "server=134.50.5.137;database=cis430sp05;user id=iusr_cis430;password=opensourceisbad" myCom2.CommandText = "SELECT * FROM Products ORDER BY ProductID" myCom2.Connection = myCon2 myCon2.Open() myReader2 = myCom2.ExecuteReader() While myReader2.Read() Response.Write(myReader2( "productID" ).ToString + "<br>" ) Response.Write(myReader2( "productName" ) + "<br>" ) Response.Write(myReader2( "productDesc" ) + "<br>" ) Response.Write( "<img src='" + myReader2( "productpicurl" ) + "' /><br><br><br>" ) End While Response.Write( "<br>" ) myCon2.Close() myCon1.Dispose() myCon2.Dispose() End Sub End Class
Recommend
More recommend