[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Girish Bhatia

1/21/2003 12:11:00 AM

I get the following error when I try to run my webpage.
The webpage was working fine until I compacted the
database.

The error is

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]
The Microsoft Jet database engine cannot open the
file '(unknown)'. It is already opened exclusively by
another user, or you need permission to view its data.
ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's
SQLSetConnectAttr failed ERROR [HY000] [Microsoft][ODBC
Microsoft Access Driver] The Microsoft Jet database engine
cannot open the file '(unknown)'. It is already opened
exclusively by another user, or you need permission to
view its data.

Any help is appreciated.

Thanks,
Girish
1 Answer

Girish Bhatia

1/21/2003 4:49:00 PM

0

Here is more info on the error....
In my login.aspx page, I have a button that calls a .net
component to return data. The code for the login.aspx page
is below...

private void cmdLogin_Click(object sender,
System.EventArgs e)
{
Data_Layer.DataManager dm1 = new DataManager
("DSN=TractorBazaar");
int ret, iUserID=0;
try
{
ret = dm1.ValidateUser(txtUserName.Text,
txtPassword.Text, ref iUserID);
switch (ret)
{
case 0: //OK
HttpCookie ckUser = new HttpCookie
("User", txtUserName.Text);
HttpCookie ckID = new HttpCookie
("ID", iUserID.ToString());
HttpResponse htpResponse =
HttpContext.Current.Response;
if (ckRemember.Checked)
{
ckUser.Expires =
DateTime.MaxValue;
ckID.Expires =
DateTime.MaxValue;
}
htpResponse.AppendCookie(ckUser);
htpResponse.AppendCookie(ckID);
dm1.LoginUser
(HttpContext.Current.Session.SessionID, txtUserName.Text);

FormsAuthentication.RedirectFromLoginPage
(txtUserName.Text, ckRemember.Checked);
break;
case -1: //Return code for incorrect
password
lblError.Text = "Password does not
match";
lblError.Visible = true;
break;
case -2: //Return code for username not
found
lblError.Text = "Username not
found";
lblError.Visible = true;
break;
}
}
catch (Exception err)
{
dm1.LogError
("Login.aspx", "cmdLogin_Click", err.Message, 1,
err.GetType().ToString());
lblError.Text = "An error occured while
processing your login. This has been logged by the
administrator";
lblError.Visible = true;
}
}


The code for the DataManager.Validate_User is as below....

Public Function ValidateUser(ByVal strUsername As
String, ByVal strPassword As String, ByRef intUserID As
Integer) As Integer
Dim objConn As ODBCConnection = New ODBCConnection
(strConn)
Dim objCmd As ODBCCommand = New ODBCCommand("",
objConn)
Dim objReader As ODBCReader

Dim strSelect As String
strSelect = "Select * from Users where Email = '"
& strUsername & "'"
objCmd.CommandText = strSelect
Try
objConn.Open()
objReader = objCmd.ExecuteReader
(CommandBehavior.SingleRow)
objReader.Read()
If (objReader.GetString(2) = strPassword) Then
intUserID = objReader.GetValue(0)
ValidateUser = 0
Else
'Password does not match
ValidateUser = -1
End If
Catch e As System.InvalidOperationException
'If the username does not exist
ValidateUser = -2
Catch e1 As Microsoft.Data.Odbc.OdbcException
LogError("DataManager", "ValidateUser",
e1.Message, e1.Errors(0).NativeError, e1.Source)
ValidateUser = -3
Finally
objConn.Close()
objCmd.Dispose()
objConn.Dispose()
End Try
End Function

I get the error below on the objConn.Open method.


I have tried to use the same DSN using a VB6 app, and it
works fine. I definitely suspect that its the ODBC.NET
driver that is causing problems. I tried to reinstall the
driver, but no use. I noticed that this problem started
after I compacted the database. Also, I tried to restart
the IIS Admin Service, but no use. There are no .ldb
files in the folder to indicate that there are any locks
on the database.

Please help, as I am out of ideas,
Thanks,
Girish Bhatia

>-----Original Message-----
>I get the following error when I try to run my webpage.
>The webpage was working fine until I compacted the
>database.
>
>The error is
>
>ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]
>The Microsoft Jet database engine cannot open the
>file '(unknown)'. It is already opened exclusively by
>another user, or you need permission to view its data.
>ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's
>SQLSetConnectAttr failed ERROR [HY000] [Microsoft][ODBC
>Microsoft Access Driver] The Microsoft Jet database
engine
>cannot open the file '(unknown)'. It is already opened
>exclusively by another user, or you need permission to
>view its data.
>
>Any help is appreciated.
>
>Thanks,
>Girish
>.
>