new to access and asp.net

Discussion in 'Databases' started by newtechmach, Jan 30, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I had used asp.net and sql server in school, on their servers with supplied connection strings.

    I am so confused of how to get started here, I put a test.mdb file in _database and I am trying to connect.

    this is my connection string
    dbconn = New OleDbConnection('PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=http://www.newtechmachineandtool.com/newtechmach/_database/test.mdb')

    and this is my test code in a button

    Dim dbCMD As OleDbCommand
    Dim dtr As OleDbDataReader
    Dim cmdInsert As OleDbCommand
    Dim strInsert As String
    Dim dbconn As OleDbConnection

    dbconn = New OleDbConnection('PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=http://www.newtechmachineandtool.com/newtechmach/_database/test.mdb')

    dbconn.Open()

    dbCMD = New OleDbCommand('INSERT INTO payroll(EmployeeName) VALUES('Bob')', dbconn)
    dbCMD.ExecuteNonQuery()

    txtDate.Text = 'Record Inserted'


    dbconn.Close()
    End Sub


    I really don't know what the problem is, I am using VS2003 and I have created a new asp web application at www.newtechmachineandtool.com/Newtech.

    Please help I am getting no where in the past 4 hours I have been stuck.
     
  2. this is wrong...

    ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=http://www.newtechmachineandtool.com/newtechmach/_database/test.mdb")

    your datasource should have a relative path like "/_database/stuff.mdb" or "e:\web\whatever\..."

    You cannot load the DB over HTTP.


    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     
  3. You could use a Server.MapPath for it like this:


    dim dbconn
    dbconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/_database/test.mdb")
    To get the actual path from any of your web folders create any simpleasp page with this code in it:

    Path Translated: <%= Request.ServerVariables("PATH_TRANSLATED") %>
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page