Results 1 to 5 of 5

Thread: Help me, this is annoying

  1. #1

    Thread Starter
    Hyperactive Member Arrow_Raider's Avatar
    Join Date
    Dec 2001
    Location
    AVR Lovers Club
    Posts
    423

    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?!

  2. #2
    Fanatic Member Patoooey's Avatar
    Join Date
    Aug 2001
    Location
    New Jersey, USA
    Posts
    774
    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

  3. #3

    Thread Starter
    Hyperactive Member Arrow_Raider's Avatar
    Join Date
    Dec 2001
    Location
    AVR Lovers Club
    Posts
    423
    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.

  4. #4
    Fanatic Member Patoooey's Avatar
    Join Date
    Aug 2001
    Location
    New Jersey, USA
    Posts
    774
    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

  5. #5

    Thread Starter
    Hyperactive Member Arrow_Raider's Avatar
    Join Date
    Dec 2001
    Location
    AVR Lovers Club
    Posts
    423
    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
  •  



Click Here to Expand Forum to Full Width