invader7
November 21st, 2009, 07:24 PM
Hello everybody, i have a huge problem and i can't understand why. i have made a program in windows 7. it connects to database with odbc code like this many times through form_load
OdbcCommand cmd;
DataSet ds;
System.Data.Odbc.OdbcDataAdapter da;
string MyString;
using (OdbcConnection cn = new OdbcConnection())
{
cn.ConnectionString = ("dsn=mydsn;");
ds = new DataSet();
MyString = "SELECT user FROM users";
da = new System.Data.Odbc.OdbcDataAdapter(MyString, cn.ConnectionString);
cmd = new OdbcCommand(MyString, cn);
da.Fill(ds, "users");
DataRow dRow = ds.Tables["users"].Rows[0];
activeusertextBox.Text = dRow.ItemArray.GetValue(0).ToString();
cn.Close();
}
and then at the end of the many odbc connections i have this
this.myTableAdapter.Fill(this.myDataSet.charge);
in my form i have a datagird view which takes data from a datasource
in windows 7 it works fine with sql server 2005 express
in windows xp it doesn't with sql server 2005 express
i get this error while i try to debug
Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\database.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".
Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\database_log.ldf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".
Cannot open user default database. Login failed.
Login failed for user 'sa'.
File activation failure. The physical file name "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\database_log.ldf" may be incorrect.
my password for sa user is correct. Any suggestions ?
OdbcCommand cmd;
DataSet ds;
System.Data.Odbc.OdbcDataAdapter da;
string MyString;
using (OdbcConnection cn = new OdbcConnection())
{
cn.ConnectionString = ("dsn=mydsn;");
ds = new DataSet();
MyString = "SELECT user FROM users";
da = new System.Data.Odbc.OdbcDataAdapter(MyString, cn.ConnectionString);
cmd = new OdbcCommand(MyString, cn);
da.Fill(ds, "users");
DataRow dRow = ds.Tables["users"].Rows[0];
activeusertextBox.Text = dRow.ItemArray.GetValue(0).ToString();
cn.Close();
}
and then at the end of the many odbc connections i have this
this.myTableAdapter.Fill(this.myDataSet.charge);
in my form i have a datagird view which takes data from a datasource
in windows 7 it works fine with sql server 2005 express
in windows xp it doesn't with sql server 2005 express
i get this error while i try to debug
Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\database.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".
Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\database_log.ldf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".
Cannot open user default database. Login failed.
Login failed for user 'sa'.
File activation failure. The physical file name "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\database_log.ldf" may be incorrect.
my password for sa user is correct. Any suggestions ?