I'm having problems with the code to connect to an SQL DataBase...i'm not experienced with asp.net.
I had once
VB.NET 2003 and SQL Server 2000 installed. Recently i installed
VB.NET 2005 and SQL Server 2005, becouse i couldn't install the earlier
VB and SQL (problems with install) so i install the new versions of
VB and SQL 2005, but this is like new to me.
The problem is that there is new features that i'm not familiarized with...I have this code, a simple code to retrieve data to the webform:
------------------------------------------------------------------------------------------
Imports System.Data.SqlClient
Partial Class data-ask
Inherits System.Web.UI.Page
Private Sub page_load()
Dim connection As SqlConnection
Dim mycommand As SqlCommand
Dim myDataReader As SqlDataReader
Dim SQLStmt As String
connection = New SqlConnection("Server=matrix\WebSite1;uid=sa;pwd=1 234;database=aspnet-books;trusted_connection=yes")
connection.Open()
SQLStmt = "SELECT * FROM books "
mycommand = New SqlCommand(SQLStmt, connection)
myDataReader = mycommand.ExecuteReader()
While myDataReader.Read()
Response.Write(myDataReader.Item("books_name") & " - " & myDataReader.Item("book_price") & " Euros<br>")
End While
connection.Close()
End Sub
End Class
-------------------------------------------------------------------------------------------
What happens is that when i load, the page is blank (no errors is shown) just blank page.
I don't know if the connection to database(outside the code) is right (permitions, etc...)
Can anyone tell me what is the problem?
Thank you....