can anyone help me why are this thread occur
1.[OleDbException (0x80004005): Not a valid file name.]
2.what is exception stack trace?
thank you =)
From where you got this error ?
What code , which application, which database ?
what does it means by "Not a valid file name"?
if the database names, i think i already names the db names correctly.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[OleDbException (0x80004005): Not a valid file name.]
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +969373
System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +86
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +29
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +4863644
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
System.Data.OleDb.OleDbConnection.Open() +40
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +31
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +112
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +287
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1297
System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +95
System.Web.UI.WebControls.ListControl.PerformSelect() +34
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
System.Web.UI.Control.DataBindChildren() +211
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102
System.Web.UI.Control.DataBind() +15
System.Web.UI.Control.DataBindChildren() +211
System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +102
System.Web.UI.Control.DataBind() +15
System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +155
System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +2539
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +57
System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +14
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +72
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +44
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
THIS IS THE CODE~~
Imports System.IO
Imports System
Imports System.Data.OleDb
Imports System.Data
Imports System.Web.UI
Imports system.data.sqlclient
Partial Class self_evaluation
Inherits System.Web.UI.Page
Private dr As OleDbDataReader
Private con As OleDbConnection
Dim logindate As Date = Format(Now(), "dd-MMM-yyyy hh:mm:ss tt")
Dim activity As String
Dim url As String
Dim IP As String
Dim row As Integer
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim context As HttpContext
context = HttpContext.Current
url = context.Request.Url.ToString()
IP = context.Request.UserHostAddress.ToString()
Dim pass = Session("StaffPassword")
If Session("loginID") = "" Then
Response.Redirect("login.aspx")
ElseIf Session("loginID") = "admin" Then
Else
If Session("head") = "yes" Then
Response.Redirect("Headhome.aspx")
Else
Response.Redirect("tsa_form.aspx")
End If
End If
End Sub
Protected Sub btnDiv_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDiv.Click
gvStaffDiv.DataBind()
End Sub
Protected Sub gvStaffDiv_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles gvStaffDiv.RowCancelingEdit
gvStaffDiv.EditIndex = -1
gvStaffDiv.DataBind()
End Sub
Protected Sub gvStaffDiv_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles gvStaffDiv.RowEditing
gvStaffDiv.EditIndex = e.NewEditIndex
gvStaffDiv.DataBind()
End Sub
Protected Sub gvStaffDiv_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs) Handles gvStaffDiv.RowUpdating
Dim staffid As String = (DirectCast(gvStaffDiv.Rows(e.RowIndex).Cells(1).FindControl("lblStaffID"), Label)).Text.ToString
Dim staffname As String = (DirectCast(gvStaffDiv.Rows(e.RowIndex).Cells(2).FindControl("txtstaffname"), TextBox)).Text.ToString
Dim stafflogin As String = (DirectCast(gvStaffDiv.Rows(e.RowIndex).Cells(3).FindControl("txtstafflogin"), TextBox)).Text.ToString
Dim password As String = (DirectCast(gvStaffDiv.Rows(e.RowIndex).Cells(4).FindControl("txtstaffpassword"), TextBox)).Text.ToString
Dim staffpost As String = (DirectCast(gvStaffDiv.Rows(e.RowIndex).Cells(5).FindControl("ddlPost"), DropDownList)).Text.ToString
Dim gradeid As Integer = Convert.ToInt16((DirectCast(gvStaffDiv.Rows(e.RowIndex).Cells(6).FindControl("ddlGrade"), DropDownList)).SelectedValue.ToString)
Dim divid As Integer = Convert.ToInt16((DirectCast(gvStaffDiv.Rows(e.RowIndex).Cells(7).FindControl("ddlDiv2"), DropDownList)).SelectedValue.ToString)
Dim deptid As Integer = Convert.ToInt16((DirectCast(gvStaffDiv.Rows(e.RowIndex).Cells(8).FindControl("ddlDept"), DropDownList)).SelectedValue.ToString)
Dim status As String = (DirectCast(gvStaffDiv.Rows(e.RowIndex).Cells(9).FindControl("rbtnActive"), RadioButtonList)).SelectedValue.ToString
Dim date_modify As Date = Format(Now(), "dd-MMM-yyyy")
Dim date_create As Date = Format(Now(), "dd-MMM-yyyy")
Dim cmd As OleDbCommand
Dim sql As String
Dim objcmd As New OleDbCommand
Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("App_Data\TSA.mdb"))
Dim headstatus As String
If staffpost = "1" Then
headstatus = "YES"
sql = "Update division SET div_head_id='" & staffid & "' WHERE div_id=" & divid & ""
cmd = New OleDbCommand(sql, con)
con.open()
cmd.ExecuteNonQuery()
con.Close()
Else
headstatus = "NO"
End If
sql = "Update staff SET staff_name='" & staffname & "',staff_login='" & stafflogin & "',staff_post='" & staffpost & "',staff_div_id='" & divid & "',staff_grade_id='" & gradeid & "',staff_dept_id='" & deptid & "',staff_active='" & status & "', date_modify = '" & date_modify & "', staff_status = '" & headstatus & "' where staff_id='" & staffid & "'"
cmd = New OleDbCommand(sql, con)
con.open()
objcmd = New OleDbCommand(sql, con)
objcmd.ExecuteNonQuery()
con.Close()
'***************************************************************
sql = "Insert into staff_historical(staff_id, staff_name, staff_post, staff_dept_id,staff_div_id, staff_grade_id,date_modify) VALUES ('" & staffid & "','" & staffname & "','" & staffpost & "','" & deptid & "','" & divid & "','" & gradeid & "','" & date_modify & "')"
cmd = New OleDbCommand(sql, con)
con.open()
objcmd = New OleDbCommand(sql, con)
objcmd.ExecuteNonQuery()
con.Close()
gvStaffDiv.DataBind()
activity = "data for " + staffname + " updated"
auditTrail(logindate, activity, IP, url)
MsgBox1.alert(" Data for " + staffname + " updated")
Response.Redirect("EditStaffByDiv.aspx")
Response.Write("<SCRIPT LANGUAGE=""JavaScript"">alert('data for '" + staffname + "' updated');window.location.href = 'EditStaffByDiv.aspx'</SCRIPT>")
End Sub
Protected Sub btnAddStaff_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddStaff.Click
gvStaffDiv.ShowFooter = True
End Sub
Protected Sub ddlDiv2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
row = CInt(gvStaffDiv.EditIndex)
divisionID2.Value = Convert.ToInt16((DirectCast(gvStaffDiv.Rows(row).Cells(6).FindControl("ddlDiv2"), DropDownList)).SelectedValue.ToString)
End Sub
Protected Sub btnCancelNew_Click(ByVal sender As Object, ByVal e As System.EventArgs)
gvStaffDiv.ShowFooter = False
End Sub
Protected Sub btnAddNew_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'Dim rowindex As Integer = DirectCast(gvStaffDiv.FooterRow.Cells(1).FindControl("txtAID"), TextBox).Text.ToString
Dim staffid As String = (DirectCast(gvStaffDiv.FooterRow.FindControl("txtAID"), TextBox).Text.ToString)
Dim staffname As String = (DirectCast(gvStaffDiv.FooterRow.FindControl("txtaName"), TextBox).Text.ToString)
Dim login As String = (DirectCast(gvStaffDiv.FooterRow.FindControl("txtAlogin"), TextBox).Text.ToString)
Dim password As String = (DirectCast(gvStaffDiv.FooterRow.FindControl("txtApassword"), TextBox).Text.ToString)
Dim post As String = (DirectCast(gvStaffDiv.FooterRow.FindControl("ddlAPost"), DropDownList)).SelectedValue.ToString
Dim grade As Integer = CInt(DirectCast(gvStaffDiv.FooterRow.FindControl("ddlAgrade"), DropDownList).SelectedValue.ToString)
Dim divid As Integer = CInt(DirectCast(gvStaffDiv.FooterRow.FindControl("ddlAdiv"), DropDownList).SelectedValue.ToString)
Dim deptid As Integer = CInt(DirectCast(gvStaffDiv.FooterRow.FindControl("ddlAdept"), DropDownList).SelectedValue.ToString)
'Dim active As String = (DirectCast(gvStaffDiv.FooterRow.FindControl("rbtnAactivate"), RadioButtonList)).SelectedValue.ToString
Dim status1 As String = (DirectCast(gvStaffDiv.FooterRow.FindControl("rbtnAactivate"), RadioButtonList)).SelectedValue.ToString
Dim con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("App_Data\TSA.mdb"))
Dim cmd As OleDbCommand
Dim sql As String
Dim objcmd As New OleDbCommand
Dim date_modify As Date = Format(Now(), "dd-MMM-yyyy")
Dim date_create As Date = Format(Now(), "dd-MMM-yyyy")
password = "password"
Dim headstatus As String
If post = "1" Then
headstatus = "YES"
sql = "Update division SET div_head_id='" & staffid & "' WHERE div_id=" & divid & ""
cmd = New OleDbCommand(sql, con)
con.open()
cmd.ExecuteNonQuery()
con.Close()
Else
headstatus = "NO"
End If
sql = "Insert into staff (staff_id,staff_name,staff_login,staff_password,staff_post,staff_grade_id,staff_div_id,staff_dept_id,staff_active,date_create,staff_status) VALUES "
sql = sql + "('" & staffid & "','" & staffname & "','" & login & "','" & password & "','" & post & "','" & grade & "','" & divid & "','" & deptid & "','" & status1 & "','" & DateTime.Now.ToShortDateString() & "','" & headstatus & "')"
cmd = New OleDbCommand(sql, con)
con.open()
objcmd = New OleDbCommand(sql, con)
objcmd.ExecuteNonQuery()
con.Close()
'***************************************************************
sql = "Insert into staff_historical(staff_id, staff_name, staff_post, staff_dept_id,staff_div_id, staff_grade_id,date_create) VALUES ('" & staffid & "','" & staffname & "','" & post & "','" & deptid & "','" & divid & "','" & grade & "','" & date_create & "')"
cmd = New OleDbCommand(sql, con)
con.open()
objcmd = New OleDbCommand(sql, con)
objcmd.ExecuteNonQuery()
con.Close()
activity = "New data for " + staffname + " saved"
auditTrail(logindate, activity, IP, url)
MsgBox1.alert(" New staff data for " + staffname + " saved")
gvStaffDiv.ShowFooter = False
Response.Redirect("EditStaffByDiv.aspx")
'Response.Write("<SCRIPT LANGUAGE=""JavaScript"">alert('New staff data for '" + staffname + "' saved');window.location.href = 'EditStaffByDiv.aspx'</SCRIPT>")
End Sub
Protected Sub ddlAdiv_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
row = CInt(gvStaffDiv.EditIndex)
divisionID2.Value = Convert.ToInt16((DirectCast(gvStaffDiv.FooterRow.Cells(7).FindControl("ddlAdiv"), DropDownList)).SelectedValue.ToString)
End Sub
Protected Sub auditTrail(ByVal logindate As String, ByVal activity As String, ByVal ip As String, ByVal url As String)
Dim con As OleDbConnection
con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("App_Data\TSA.mdb"))
con.Open()
'logindate = Format(Now(), "dd/MM/yyyy hh:mm:ss tt")
Dim command As New OleDbCommand("INSERT INTO AuditLog ([userID],[department],[Date],[URL],[IP],[Activity]) values (@us_ID,@department,@date,@url,@ip,@activity)", con)
command.Parameters.AddWithValue("@us_ID", Session("loginID"))
command.Parameters.AddWithValue("@department", Session("DeptID"))
command.Parameters.AddWithValue("@date", logindate)
'command.Parameters.AddWithValue("@time", logintime)
command.Parameters.AddWithValue("@url", url)
command.Parameters.AddWithValue("@ip", ip)
command.Parameters.AddWithValue("@activity", activity)
command.ExecuteNonQuery()
con.Close()
End Sub
End Class
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.