Access Database

Discussion in 'Databases' started by Bruce, Mar 31, 2003.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Bruce

    Bruce DiscountASP.NET Staff

    You can upload your database file using FTP.

    You then use server.mappath("/database.mdb") in place of c:\vdtdb
    {you need to replace with the path name}


    quote:Originally posted by woodhick

    hi,

    I have an Access database that resides in c:\VDTDB that I would like to transfer over to your server. I connect to it via a connection string in the web.Config file of my web application. How do I do this?

    Thanks,

    Mike
    </blockquote id="quote"></font id="quote">
     
  2. hi,

    I have an Access database that resides in c:\VDTDB that I would like to transfer over to your server. I connect to it via a connection string in the web.Config file of my web application. How do I do this?

    Thanks,

    Mike
     
  3. I tried to use the server.mappath("/database.mdb") and got an error saying that it could not locate the database.

    Here is what I want: The database is at www.cindyandmikesconsulting.com/vdt/data/vdtdb.mdb. here is my current connection string " <add key="VDTString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Server.MapPath(\data\vdtdb.mdb);Mode=ReadWrite|Share Deny None;Persist Security Info=False/>" in the appsettings section of my Web.config file. How do I make this work?

    Thanks for your patience.

    Mike



    quote:Originally posted by bruce

    You can upload your database file using FTP.

    You then use server.mappath("/database.mdb") in place of c:\vdtdb
    {you need to replace with the path name}


    quote:Originally posted by woodhick

    hi,

    I have an Access database that resides in c:\VDTDB that I would like to transfer over to your server. I connect to it via a connection string in the web.Config file of my web application. How do I do this?

    Thanks,

    Mike
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
     
  4. Bruce

    Bruce DiscountASP.NET Staff

    Try

    server.mappath("/vdt/data/vdtdb.mdb")



    quote:Originally posted by woodhick

    I tried to use the server.mappath("/database.mdb") and got an error saying that it could not locate the database.

    Here is what I want: The database is at www.cindyandmikesconsulting.com/vdt/data/vdtdb.mdb. here is my current connection string " <add key="VDTString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Server.MapPath(\data\vdtdb.mdb);Mode=ReadWrite|Share Deny None;Persist Security Info=False/>" in the appsettings section of my Web.config file. How do I make this work?

    Thanks for your patience.

    Mike



    quote:Originally posted by bruce

    You can upload your database file using FTP.

    You then use server.mappath("/database.mdb") in place of c:\vdtdb
    {you need to replace with the path name}


    quote:Originally posted by woodhick

    hi,

    I have an Access database that resides in c:\VDTDB that I would like to transfer over to your server. I connect to it via a connection string in the web.Config file of my web application. How do I do this?

    Thanks,

    Mike
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
     
  5. Bruce,

    I got this error:

    "Could not find file 'C:\WINDOWS\system32\FilePath.toString'."

    Here is the connection string now:

    <add key="VDTString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=server.mappath(/vdt/data/vdtdb.mdb);Mode=ReadWrite|Share Deny None;Persist Security Info=False"/>


    do you have any other idea's?

    Thanks,

    mike

    quote:Originally posted by bruce

    Try

    server.mappath("/vdt/data/vdtdb.mdb")



    quote:Originally posted by woodhick

    I tried to use the server.mappath("/database.mdb") and got an error saying that it could not locate the database.

    Here is what I want: The database is at www.cindyandmikesconsulting.com/vdt/data/vdtdb.mdb. here is my current connection string " <add key="VDTString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Server.MapPath(\data\vdtdb.mdb);Mode=ReadWrite|Share Deny None;Persist Security Info=False/>" in the appsettings section of my Web.config file. How do I make this work?

    Thanks for your patience.

    Mike



    quote:Originally posted by bruce

    You can upload your database file using FTP.

    You then use server.mappath("/database.mdb") in place of c:\vdtdb
    {you need to replace with the path name}


    quote:Originally posted by woodhick

    hi,

    I have an Access database that resides in c:\VDTDB that I would like to transfer over to your server. I connect to it via a connection string in the web.Config file of my web application. How do I do this?

    Thanks,

    Mike
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
     
  6. Bruce

    Bruce DiscountASP.NET Staff

    I misread your original post, i didn't realize you are trying to put this into your web.config file.

    Server.mappath is a function, as far as I know, I don't think you can put a function in the web.config file.

    Try use the full path instead

    e:\web\[yourusernam]\htdocs\vdt\data\vdtdb.mdb

    You can find your full path at the account information section in the control panel.

    quote:Originally posted by woodhick

    Bruce,

    I got this error:

    "Could not find file 'C:\WINDOWS\system32\FilePath.toString'."

    Here is the connection string now:

    <add key="VDTString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=server.mappath(/vdt/data/vdtdb.mdb);Mode=ReadWrite|Share Deny None;Persist Security Info=False"/>


    do you have any other idea's?

    Thanks,

    mike

    </blockquote id="quote"></font id="quote">
     
  7. You might try creating an ASP page with the following:

    --------------------------------------------------------------

    <table align="center">
    <tr><th>Key</th><th>Value</th></tr>
    <%</font id="red">
    For Each key in Request.ServerVariables
    Response.Write "<tr><td align=right valign=top><strong>" & key & ":</strong></td>"
    Response.Write "<td>" & Request.ServerVariables(key) & "</td></tr>"
    Next
    %></font id="red">
    </table>

    --------------------------------------------------
     
  8. Bruce,

    I did as yo suggested and now I get the following error.

    "System.Data.OleDb.OleDbException: Disk or network error."

    Any other idea's?

    Thanks,

    Mike




    quote:Originally posted by bruce

    I misread your original post, i didn't realize you are trying to put this into your web.config file.

    Server.mappath is a function, as far as I know, I don't think you can put a function in the web.config file.

    Try use the full path instead

    e:\web\[yourusernam]\htdocs\vdt\data\vdtdb.mdb

    You can find your full path at the account information section in the control panel.

    quote:Originally posted by woodhick

    Bruce,

    I got this error:

    "Could not find file 'C:\WINDOWS\system32\FilePath.toString'."

    Here is the connection string now:

    <add key="VDTString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=server.mappath(/vdt/data/vdtdb.mdb);Mode=ReadWrite|Share Deny None;Persist Security Info=False"/>


    do you have any other idea's?

    Thanks,

    mike

    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
     
  9. Bruce

    Bruce DiscountASP.NET Staff

    can you post the whole code snippet?



    quote:Originally posted by woodhick

    Bruce,

    I did as yo suggested and now I get the following error.

    "System.Data.OleDb.OleDbException: Disk or network error."

    Any other idea's?

    Thanks,

    Mike




    quote:Originally posted by bruce

    I misread your original post, i didn't realize you are trying to put this into your web.config file.

    Server.mappath is a function, as far as I know, I don't think you can put a function in the web.config file.

    Try use the full path instead

    e:\web\[yourusernam]\htdocs\vdt\data\vdtdb.mdb

    You can find your full path at the account information section in the control panel.

    quote:Originally posted by woodhick

    Bruce,

    I got this error:

    "Could not find file 'C:\WINDOWS\system32\FilePath.toString'."

    Here is the connection string now:

    <add key="VDTString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=server.mappath(/vdt/data/vdtdb.mdb);Mode=ReadWrite|Share Deny None;Persist Security Info=False"/>


    do you have any other idea's?

    Thanks,

    mike

    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
     
  10. Bruce,

    Here is the code:

    Public Class ExtSurvey
    Inherits System.Web.UI.Page
    Protected WithEvents Image1 As System.Web.UI.WebControls.Image
    Protected WithEvents chkbx2 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Chkbx3 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Chkbx4 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Chkbx5 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Chkbx6 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx7 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Chkbx8 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx9 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx10 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx12 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx13 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx14 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx15 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx16 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx17 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Label1 As System.Web.UI.WebControls.Label
    Protected WithEvents Label2 As System.Web.UI.WebControls.Label
    Protected WithEvents Label3 As System.Web.UI.WebControls.Label
    Protected WithEvents txtboxdiags As System.Web.UI.WebControls.TextBox
    Protected WithEvents Label4 As System.Web.UI.WebControls.Label
    Protected WithEvents Label5 As System.Web.UI.WebControls.Label
    Protected WithEvents Label6 As System.Web.UI.WebControls.Label
    Protected WithEvents Radiobuttonlist2 As System.Web.UI.WebControls.RadioButtonList
    Protected WithEvents RadioButtonList1 As System.Web.UI.WebControls.RadioButtonList
    Protected WithEvents RadioButtonList3 As System.Web.UI.WebControls.RadioButtonList
    Protected WithEvents Button1 As System.Web.UI.WebControls.Button
    Protected WithEvents chkbx1 As System.Web.UI.WebControls.CheckBox
    Public shours As String
    Public sInjury As String
    Public sPain As String
    Public sSTRcon As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=e:\web\cindyandmik\htdocs\vdt2\data\vdtdb.mdb"
    Protected WithEvents Label7 As System.Web.UI.WebControls.Label
    Protected WithEvents TxtboxBN As System.Web.UI.WebControls.TextBox
    Protected WithEvents TxtboxLN As System.Web.UI.WebControls.TextBox
    Protected WithEvents TxtboxFN As System.Web.UI.WebControls.TextBox
    Protected WithEvents LabelIP As System.Web.UI.WebControls.Label
    Protected WithEvents Image2 As System.Web.UI.WebControls.Image
    Protected WithEvents Image3 As System.Web.UI.WebControls.Image
    Protected WithEvents Label8 As System.Web.UI.WebControls.Label
    Protected WithEvents ChkBx18 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Chkbx19 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Textboxem As System.Web.UI.WebControls.TextBox
    Public QID As String
    #Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    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 VisitorIP As String
    VisitorIP = Request.ServerVariables("REMOTE_ADDR")
    LabelIP.Text = VisitorIP.ToString
    End Sub
    Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    'On Error Resume Next
    Dim strSQL2 As String
    Dim strSQL3 As String
    Dim Test1 As CheckBox
    Dim objConnection As OleDb.OleDbConnection
    Dim objCommand As OleDb.OleDbCommand
    Dim strSQL As String = "INSERT INTO UserSurveyInformation(UserFirstName, UserLastName, UserBuilding, UserEmail, UserIPAddress)VALUES(" & "'" & TxtboxFN.Text & "'," & "'" & TxtboxLN.Text & "'," & "'" & TxtboxBN.Text & "'," & "'" & Textboxem.Text & "'," & "'" & LabelIP.Text & "'" & ")"
    'Here is where I get the error
    objConnection = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=e:\web\cindyandmik\htdocs\vdt2\data\vdtdb.mdb")
    objCommand = New OleDb.OleDbCommand(strSQL, objConnection)
    objCommand.Connection.Open()
    objCommand.ExecuteNonQuery()
    objCommand.Connection.Close()
    strSQL2 = "SELECT TOP 1 UserSurveyInformation.ID FROM(UserSurveyInformation) ORDER BY UserSurveyInformation.ID DESC"
    Dim MyCommand As New OleDb.OleDbCommand(strSQL2, objConnection)
    MyCommand.Connection.Open()
    QID = MyCommand.ExecuteScalar()
    MyCommand.Connection.Close()
    Label3.Text = QID.ToString
    strSQL3 = "SELECT Count(*) from Jobfactor"
    Dim MyCommand2 As New OleDb.OleDbCommand(strSQL3, objConnection)
    MyCommand2.Connection.Open()
    Label5.Text = MyCommand.ExecuteScalar()
    MyCommand.Connection.Close()
    Dim I As Integer = 1
    Dim zanswer As Integer
    Dim cb As CheckBox
    Dim dgi As DataGridItem
    Dim JFID As Integer
    Dim objConnectiona As OleDb.OleDbConnection
    Dim objCommanda As OleDb.OleDbCommand
    Dim strSQLa As String


    Dim sbody1, sbody2, sbody3, sbody4, sbody5, sbody6, sbody7, sbody8, sbody9, sbody10, sbody11, sbody12, sbody13, sbody14, sbody15, sbody16, sbody17, sbody18, sbody19 As String

    Dim UpdateSQL As String

    If RadioButtonList1.SelectedIndex > -1 Then
    sInjury = RadioButtonList1.SelectedItem.Text
    Else : sInjury = "N/A"
    End If

    If sInjury = "" Then sInjury = "N/A"

    If Radiobuttonlist2.SelectedIndex > -1 Then
    shours = Radiobuttonlist2.SelectedItem.Value
    Else : shours = "N/A"
    End If

    If shours = "" Then shours = "N/A"

    If RadioButtonList3.SelectedIndex > -1 Then
    sPain = RadioButtonList3.SelectedItem.Value
    Else : sPain = "N/A"
    End If
    If sPain = "" Then sPain = "N/A"
    If txtboxdiags.Text = "" Then txtboxdiags.Text = "N/A"
    If chkbx1.Checked = True Then sbody1 = "Yes" Else sbody1 = "No"
    If chkbx2.Checked = True Then sbody2 = "Yes" Else sbody2 = "No"
    If Chkbx3.Checked = True Then sbody3 = "Yes" Else sbody3 = "No"
    If Chkbx4.Checked = True Then sbody4 = "Yes" Else sbody4 = "No"
    If Chkbx5.Checked = True Then sbody5 = "Yes" Else sbody5 = "No"
    If Chkbx6.Checked = True Then sbody6 = "Yes" Else sbody6 = "No"
    If ChkBx7.Checked = True Then sbody7 = "Yes" Else sbody7 = "No"
    If Chkbx8.Checked = True Then sbody8 = "Yes" Else sbody8 = "No"
    If ChkBx9.Checked = True Then sbody9 = "Yes" Else sbody9 = "No"
    If ChkBx10.Checked = True Then sbody10 = "Yes" Else sbody10 = "No"
    If ChkBx12.Checked = True Then sbody12 = "Yes" Else sbody12 = "No"
    If ChkBx13.Checked = True Then sbody13 = "Yes" Else sbody13 = "No"
    If ChkBx14.Checked = True Then sbody14 = "Yes" Else sbody14 = "No"
    If ChkBx15.Checked = True Then sbody15 = "Yes" Else sbody15 = "No"
    If ChkBx16.Checked = True Then sbody16 = "Yes" Else sbody16 = "No"
    If ChkBx17.Checked = True Then sbody17 = "Yes" Else sbody17 = "No"
    If ChkBx18.Checked = True Then sbody18 = "Yes" Else sbody18 = "No"
    If Chkbx19.Checked = True Then sbody19 = "Yes" Else sbody19 = "No"

    UpdateSQL = "Update UserSurveyInformation Set Hours =" & "'" & shours & "'" & ", Pain=" & "'" & sPain & "'" & ", Body1=" & "'" & sbody1 & "'" & ", Body2=" & "'" & sbody2 & "'" & ", Body3=" & "'" & sbody3 & "'" & ", Body4=" & "'" & sbody4 & "'" & ", Body5=" & "'" & sbody5 & "'" & ", Body6=" & "'" & sbody6 & "'" & ", Body7=" & "'" & sbody7 & "'" & ", Body8=" & "'" & sbody8 & "'" & ", Body9=" & "'" & sbody9 & "'" & ", Body10=" & "'" & sbody10 & "'" & ", Body12=" & "'" & sbody12 & "'" & ", Body13=" & "'" & sbody13 & "'" & ", Body14=" & "'" & sbody14 & "'" & ", Body15=" & "'" & sbody15 & "'" & ", Body16=" & "'" & sbody16 & "'" & ", Body17=" & "'" & sbody17 & "'" & ",Body18=" & "'" & sbody18 & "'" & ",Body19=" & "'" & sbody19 & "'" & ", Diags=" & "'" & txtboxdiags.Text & "'" & " where ID=" & QID
    Dim objCon As OleDb.OleDbConnection
    objCon = New OleDb.OleDbConnection(sStrcon)
    Label7.Text = UpdateSQL
    objCommand = New OleDb.OleDbCommand(UpdateSQL, objCon)
    objCommand.Connection.Open()
    objCommand.ExecuteNonQuery()
    objCommand.Connection.Close()
    Response.Redirect("JobFactorSurveyb.aspx?NQ=" & Label3.Text)
    End Sub

    Private Sub ChkBx9_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChkBx9.CheckedChanged

    End Sub
    End Class

    Thanks for the help,

    Mike




    quote:Originally posted by bruce

    can you post the whole code snippet?



    quote:Originally posted by woodhick

    Bruce,

    I did as yo suggested and now I get the following error.

    "System.Data.OleDb.OleDbException: Disk or network error."

    Any other idea's?

    Thanks,

    Mike




    quote:Originally posted by bruce

    I misread your original post, i didn't realize you are trying to put this into your web.config file.

    Server.mappath is a function, as far as I know, I don't think you can put a function in the web.config file.

    Try use the full path instead

    e:\web\[yourusernam]\htdocs\vdt\data\vdtdb.mdb

    You can find your full path at the account information section in the control panel.

    quote:Originally posted by woodhick

    Bruce,

    I got this error:

    "Could not find file 'C:\WINDOWS\system32\FilePath.toString'."

    Here is the connection string now:

    <add key="VDTString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=server.mappath(/vdt/data/vdtdb.mdb);Mode=ReadWrite|Share Deny None;Persist Security Info=False"/>


    do you have any other idea's?

    Thanks,

    mike

    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
     
  11. Bruce

    Bruce DiscountASP.NET Staff

    Your code looks fine.

    The only reason i can think of is that the database file is not there.

    quote:Originally posted by woodhick

    Bruce,

    Here is the code:

    Public Class ExtSurvey
    Inherits System.Web.UI.Page
    Protected WithEvents Image1 As System.Web.UI.WebControls.Image
    Protected WithEvents chkbx2 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Chkbx3 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Chkbx4 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Chkbx5 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Chkbx6 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx7 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Chkbx8 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx9 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx10 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx12 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx13 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx14 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx15 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx16 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents ChkBx17 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Label1 As System.Web.UI.WebControls.Label
    Protected WithEvents Label2 As System.Web.UI.WebControls.Label
    Protected WithEvents Label3 As System.Web.UI.WebControls.Label
    Protected WithEvents txtboxdiags As System.Web.UI.WebControls.TextBox
    Protected WithEvents Label4 As System.Web.UI.WebControls.Label
    Protected WithEvents Label5 As System.Web.UI.WebControls.Label
    Protected WithEvents Label6 As System.Web.UI.WebControls.Label
    Protected WithEvents Radiobuttonlist2 As System.Web.UI.WebControls.RadioButtonList
    Protected WithEvents RadioButtonList1 As System.Web.UI.WebControls.RadioButtonList
    Protected WithEvents RadioButtonList3 As System.Web.UI.WebControls.RadioButtonList
    Protected WithEvents Button1 As System.Web.UI.WebControls.Button
    Protected WithEvents chkbx1 As System.Web.UI.WebControls.CheckBox
    Public shours As String
    Public sInjury As String
    Public sPain As String
    Public sSTRcon As String = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=e:\web\cindyandmik\htdocs\vdt2\data\vdtdb.mdb"
    Protected WithEvents Label7 As System.Web.UI.WebControls.Label
    Protected WithEvents TxtboxBN As System.Web.UI.WebControls.TextBox
    Protected WithEvents TxtboxLN As System.Web.UI.WebControls.TextBox
    Protected WithEvents TxtboxFN As System.Web.UI.WebControls.TextBox
    Protected WithEvents LabelIP As System.Web.UI.WebControls.Label
    Protected WithEvents Image2 As System.Web.UI.WebControls.Image
    Protected WithEvents Image3 As System.Web.UI.WebControls.Image
    Protected WithEvents Label8 As System.Web.UI.WebControls.Label
    Protected WithEvents ChkBx18 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Chkbx19 As System.Web.UI.WebControls.CheckBox
    Protected WithEvents Textboxem As System.Web.UI.WebControls.TextBox
    Public QID As String
    #Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    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 VisitorIP As String
    VisitorIP = Request.ServerVariables("REMOTE_ADDR")
    LabelIP.Text = VisitorIP.ToString
    End Sub
    Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    'On Error Resume Next
    Dim strSQL2 As String
    Dim strSQL3 As String
    Dim Test1 As CheckBox
    Dim objConnection As OleDb.OleDbConnection
    Dim objCommand As OleDb.OleDbCommand
    Dim strSQL As String = "INSERT INTO UserSurveyInformation(UserFirstName, UserLastName, UserBuilding, UserEmail, UserIPAddress)VALUES(" & "'" & TxtboxFN.Text & "'," & "'" & TxtboxLN.Text & "'," & "'" & TxtboxBN.Text & "'," & "'" & Textboxem.Text & "'," & "'" & LabelIP.Text & "'" & ")"
    'Here is where I get the error
    objConnection = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=e:\web\cindyandmik\htdocs\vdt2\data\vdtdb.mdb")
    objCommand = New OleDb.OleDbCommand(strSQL, objConnection)
    objCommand.Connection.Open()
    objCommand.ExecuteNonQuery()
    objCommand.Connection.Close()
    strSQL2 = "SELECT TOP 1 UserSurveyInformation.ID FROM(UserSurveyInformation) ORDER BY UserSurveyInformation.ID DESC"
    Dim MyCommand As New OleDb.OleDbCommand(strSQL2, objConnection)
    MyCommand.Connection.Open()
    QID = MyCommand.ExecuteScalar()
    MyCommand.Connection.Close()
    Label3.Text = QID.ToString
    strSQL3 = "SELECT Count(*) from Jobfactor"
    Dim MyCommand2 As New OleDb.OleDbCommand(strSQL3, objConnection)
    MyCommand2.Connection.Open()
    Label5.Text = MyCommand.ExecuteScalar()
    MyCommand.Connection.Close()
    Dim I As Integer = 1
    Dim zanswer As Integer
    Dim cb As CheckBox
    Dim dgi As DataGridItem
    Dim JFID As Integer
    Dim objConnectiona As OleDb.OleDbConnection
    Dim objCommanda As OleDb.OleDbCommand
    Dim strSQLa As String


    Dim sbody1, sbody2, sbody3, sbody4, sbody5, sbody6, sbody7, sbody8, sbody9, sbody10, sbody11, sbody12, sbody13, sbody14, sbody15, sbody16, sbody17, sbody18, sbody19 As String

    Dim UpdateSQL As String

    If RadioButtonList1.SelectedIndex > -1 Then
    sInjury = RadioButtonList1.SelectedItem.Text
    Else : sInjury = "N/A"
    End If

    If sInjury = "" Then sInjury = "N/A"

    If Radiobuttonlist2.SelectedIndex > -1 Then
    shours = Radiobuttonlist2.SelectedItem.Value
    Else : shours = "N/A"
    End If

    If shours = "" Then shours = "N/A"

    If RadioButtonList3.SelectedIndex > -1 Then
    sPain = RadioButtonList3.SelectedItem.Value
    Else : sPain = "N/A"
    End If
    If sPain = "" Then sPain = "N/A"
    If txtboxdiags.Text = "" Then txtboxdiags.Text = "N/A"
    If chkbx1.Checked = True Then sbody1 = "Yes" Else sbody1 = "No"
    If chkbx2.Checked = True Then sbody2 = "Yes" Else sbody2 = "No"
    If Chkbx3.Checked = True Then sbody3 = "Yes" Else sbody3 = "No"
    If Chkbx4.Checked = True Then sbody4 = "Yes" Else sbody4 = "No"
    If Chkbx5.Checked = True Then sbody5 = "Yes" Else sbody5 = "No"
    If Chkbx6.Checked = True Then sbody6 = "Yes" Else sbody6 = "No"
    If ChkBx7.Checked = True Then sbody7 = "Yes" Else sbody7 = "No"
    If Chkbx8.Checked = True Then sbody8 = "Yes" Else sbody8 = "No"
    If ChkBx9.Checked = True Then sbody9 = "Yes" Else sbody9 = "No"
    If ChkBx10.Checked = True Then sbody10 = "Yes" Else sbody10 = "No"
    If ChkBx12.Checked = True Then sbody12 = "Yes" Else sbody12 = "No"
    If ChkBx13.Checked = True Then sbody13 = "Yes" Else sbody13 = "No"
    If ChkBx14.Checked = True Then sbody14 = "Yes" Else sbody14 = "No"
    If ChkBx15.Checked = True Then sbody15 = "Yes" Else sbody15 = "No"
    If ChkBx16.Checked = True Then sbody16 = "Yes" Else sbody16 = "No"
    If ChkBx17.Checked = True Then sbody17 = "Yes" Else sbody17 = "No"
    If ChkBx18.Checked = True Then sbody18 = "Yes" Else sbody18 = "No"
    If Chkbx19.Checked = True Then sbody19 = "Yes" Else sbody19 = "No"

    UpdateSQL = "Update UserSurveyInformation Set Hours =" & "'" & shours & "'" & ", Pain=" & "'" & sPain & "'" & ", Body1=" & "'" & sbody1 & "'" & ", Body2=" & "'" & sbody2 & "'" & ", Body3=" & "'" & sbody3 & "'" & ", Body4=" & "'" & sbody4 & "'" & ", Body5=" & "'" & sbody5 & "'" & ", Body6=" & "'" & sbody6 & "'" & ", Body7=" & "'" & sbody7 & "'" & ", Body8=" & "'" & sbody8 & "'" & ", Body9=" & "'" & sbody9 & "'" & ", Body10=" & "'" & sbody10 & "'" & ", Body12=" & "'" & sbody12 & "'" & ", Body13=" & "'" & sbody13 & "'" & ", Body14=" & "'" & sbody14 & "'" & ", Body15=" & "'" & sbody15 & "'" & ", Body16=" & "'" & sbody16 & "'" & ", Body17=" & "'" & sbody17 & "'" & ",Body18=" & "'" & sbody18 & "'" & ",Body19=" & "'" & sbody19 & "'" & ", Diags=" & "'" & txtboxdiags.Text & "'" & " where ID=" & QID
    Dim objCon As OleDb.OleDbConnection
    objCon = New OleDb.OleDbConnection(sStrcon)
    Label7.Text = UpdateSQL
    objCommand = New OleDb.OleDbCommand(UpdateSQL, objCon)
    objCommand.Connection.Open()
    objCommand.ExecuteNonQuery()
    objCommand.Connection.Close()
    Response.Redirect("JobFactorSurveyb.aspx?NQ=" & Label3.Text)
    End Sub

    Private Sub ChkBx9_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChkBx9.CheckedChanged

    End Sub
    End Class

    Thanks for the help,

    Mike




    quote:Originally posted by bruce

    can you post the whole code snippet?



    quote:Originally posted by woodhick

    Bruce,

    I did as yo suggested and now I get the following error.

    "System.Data.OleDb.OleDbException: Disk or network error."

    Any other idea's?

    Thanks,

    Mike




    quote:Originally posted by bruce

    I misread your original post, i didn't realize you are trying to put this into your web.config file.

    Server.mappath is a function, as far as I know, I don't think you can put a function in the web.config file.

    Try use the full path instead

    e:\web\[yourusernam]\htdocs\vdt\data\vdtdb.mdb

    You can find your full path at the account information section in the control panel.

    quote:Originally posted by woodhick

    Bruce,

    I got this error:

    "Could not find file 'C:\WINDOWS\system32\FilePath.toString'."

    Here is the connection string now:

    <add key="VDTString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=server.mappath(/vdt/data/vdtdb.mdb);Mode=ReadWrite|Share Deny None;Persist Security Info=False"/>


    do you have any other idea's?

    Thanks,

    mike

    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
    </blockquote id="quote"></font id="quote">
     
  12. In your web.config file, change the data source to e:\web\<your username>\htdoc\vdtdb\<yourdb.mdb>

    That should work for you.

    quote:Originally posted by woodhick

    hi,

    I have an Access database that resides in c:\VDTDB that I would like to transfer over to your server. I connect to it via a connection string in the web.Config file of my web application. How do I do this?

    Thanks,

    Mike
    </blockquote id="quote"></font id="quote">

    Steven Cowley
     
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