|
-
Sep 1st, 2002, 09:40 PM
#1
Thread Starter
Hyperactive Member
Help me, this is annoying
I am trying to fidn out how to read a frikin database. I can't seem to find anythign that tells me how. I am using web matrix so it has code snippits and it does have one for reading a db, but then i don't know what to do after it makes the function. here's what i ahve:
Code:
Function MyQueryMethod(ByVal iDData As Integer) As System.Data.SqlClient.SqlDataReader
Dim connectionString As String = "server='localhost'; trusted_connection=true; Database='testdb'"
Dim sqlConnection As System.Data.SqlClient.SqlConnection = New System.Data.SqlClient.SqlConnection(connectionString)
Dim queryString As String = "SELECT [TestTable].[IDData], [TestTable].[ValueData] FROM [TestTable] WHERE ([Tes"& _
"tTable].[IDData] = @IDData)"
Dim sqlCommand As System.Data.SqlClient.SqlCommand = New System.Data.SqlClient.SqlCommand(queryString, sqlConnection)
sqlCommand.Parameters.Add("@IDData", System.Data.SqlDbType.Int).Value = iDData
sqlConnection.Open
Dim dataReader As System.Data.SqlClient.SqlDataReader = sqlCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
Return dataReader
End Function
i don't know what any of that is, but the snipit thing put it there.
now what the hell do i do after i have that?!
-
Sep 2nd, 2002, 12:14 AM
#2
Fanatic Member
Matrix has several samples that show how to get started. Click on File->New and select "Data Pages" on the left. Then select "Simple Data Page" on the right.
In that file, change the ConnectionString to your DB and test it out.
Also, at ASP.Net they have a Guided Tour and a online book to read. Explains all you should need.
Tour
http://www.asp.net/webmatrix/tour/getstarted/intro.aspx
Book
http://www.asp.net/Tools/redir.aspx?path=webmatrixbook
John
-
Sep 2nd, 2002, 08:35 AM
#3
Thread Starter
Hyperactive Member
Every example doesn't work. But i just found out how to do it. Now i just found out that the files that it makes are mdf files. instead of mdb. My stupid hosting thing doesn't let me use mdf files, it only lets me use mdb files. Is there any way that my comp can be the server without haveing to pay.
-
Sep 2nd, 2002, 05:43 PM
#4
Fanatic Member
Install Windowns 2000 or XP and install the IIS component that comes with it. Run a "web server" locally.
There is also a product called MSDE. It's a free, limited version of SQL Sever, You can download that at asp.net also. That's is what the Matrix samples are looking, hence the mdf files.
Or seach the forums at asp.net for information on connecting to MDB files. I know I've seen several posts on that.
John
-
Sep 3rd, 2002, 02:51 PM
#5
Thread Starter
Hyperactive Member
I have windows 2000 and msde and iis installed
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|