Click here to Skip to main content
15,897,273 members
Home / Discussions / C#
   

C#

 
GeneralRe: extended procedure for sql server Pin
Heath Stewart11-Nov-03 18:55
protectorHeath Stewart11-Nov-03 18:55 
GeneralRe: extended procedure for sql server Pin
Heath Stewart11-Nov-03 3:12
protectorHeath Stewart11-Nov-03 3:12 
GeneralRight to left problem Pin
Mohaqeq200211-Nov-03 0:41
sussMohaqeq200211-Nov-03 0:41 
GeneralRe: Right to left problem Pin
Heath Stewart11-Nov-03 3:19
protectorHeath Stewart11-Nov-03 3:19 
QuestionIs MS Access transaction-aware? Pin
CillyMe10-Nov-03 23:53
CillyMe10-Nov-03 23:53 
AnswerRe: Is MS Access transaction-aware? Pin
Hesham Amin11-Nov-03 0:41
Hesham Amin11-Nov-03 0:41 
GeneralRe: Is MS Access transaction-aware? Pin
CillyMe11-Nov-03 2:02
CillyMe11-Nov-03 2:02 
GeneralRe: Is MS Access transaction-aware? Pin
CillyMe11-Nov-03 2:50
CillyMe11-Nov-03 2:50 
I meant to say, can it participate in a COM+ transaction in following manner:

[Transaction(TransactionOption.Required)]
... other stuff ...
public class AccessDbManager
{
...
public void UpdateClientProfile(...);
public void UpdatePosition(...);
public void GetPosition(...);
...
}

I'm asking this because there's a piece of code that worked perfectly fine in a C# console app, but failed mysteriously when I embed it inside one method of a Transaction enabled serviced component... Here's the code. I tested it many times. It worked in a C# console app.

int count = -1;
string db_username;
string db_passwd;
int db_numlogin;
string connString;
OleDbConnection connUsers;
OleDbDataAdapter daUsers;
DataSet dsUsers;

EventLog log = new EventLog("Application");
log.Source = "AccessDbMaster";

try
{ //try block

retcode = -1;

connString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Program Files\SomeDir\datasource\users.mdb; User ID=Admin; Password=";
Trace.WriteLine(connString);

connUsers = new OleDbConnection(connString);
daUsers = new OleDbDataAdapter("SELECT * FROM Users WHERE username='"+ username + "' AND passwd='" + passwd + "'", connUsers);
dsUsers = new DataSet();


**********************************************************************
daUsers.Fill(dsUsers, "Users"); //BOOM. Failed here. "No error information available: E_NOINTERFACE(0x80004002)."

**********************************************************************

count = dsUsers.Tables["Users"].Rows.Count;

if(count==0) {
log.WriteEntry("AccessDbMaster authentication failed. User not found");
return;
}

foreach(DataRow user in dsUsers.Tables["Users"].Rows)
{
db_username = user["username"].ToString();
db_passwd = user["passwd"].ToString();
db_numlogin = (int) user["numlogin"];

retcode = db_numlogin; //return value

//Increment number of login:
db_numlogin++;
user["numlogin"]=db_numlogin;
}

OleDbCommandBuilder cmdBuilder = new OleDbCommandBuilder(daUsers);
daUsers.Update(dsUsers, "Users");

connUsers.Close();

} //try block
catch(Exception err)
{
log.WriteEntry("AccessDbMaster authentication failed. Info: " + err.Message);
retcode=-1;
ContextUtil.SetAbort();
}

I'm not out of the woods yet. Any advice will be greatly appreciated.
GeneralRe: Is MS Access transaction-aware? Pin
Hesham Amin11-Nov-03 7:44
Hesham Amin11-Nov-03 7:44 
GeneralRe: Is MS Access transaction-aware? Pin
CillyMe11-Nov-03 16:47
CillyMe11-Nov-03 16:47 
GeneralBuilding Objects with Reflection Pin
Dennis Klein10-Nov-03 22:49
Dennis Klein10-Nov-03 22:49 
GeneralRe: Building Objects with Reflection Pin
Heath Stewart11-Nov-03 3:32
protectorHeath Stewart11-Nov-03 3:32 
GeneralRe: Building Objects with Reflection Pin
Dennis Klein11-Nov-03 22:12
Dennis Klein11-Nov-03 22:12 
GeneralRe: Building Objects with Reflection Pin
Heath Stewart12-Nov-03 2:39
protectorHeath Stewart12-Nov-03 2:39 
GeneralRe: Building Objects with Reflection Pin
Dennis Klein12-Nov-03 3:25
Dennis Klein12-Nov-03 3:25 
Generalcommunicate with service Pin
Member 67650610-Nov-03 22:45
Member 67650610-Nov-03 22:45 
GeneralRe: communicate with service Pin
Arjan Einbu10-Nov-03 23:03
Arjan Einbu10-Nov-03 23:03 
GeneralCOM+ application load balancing Pin
CillyMe10-Nov-03 20:34
CillyMe10-Nov-03 20:34 
GeneralLoading data to string variable Pin
Rostrox10-Nov-03 19:19
Rostrox10-Nov-03 19:19 
GeneralRe: Loading data to string variable Pin
Corinna John10-Nov-03 19:47
Corinna John10-Nov-03 19:47 
GeneralRe: Loading data to string variable Pin
Jeff Varszegi11-Nov-03 4:54
professionalJeff Varszegi11-Nov-03 4:54 
GeneralRe: Loading data to string variable Pin
Jeff Varszegi11-Nov-03 6:04
professionalJeff Varszegi11-Nov-03 6:04 
GeneralControl/Class Existence Pin
Anonymous10-Nov-03 17:47
Anonymous10-Nov-03 17:47 
GeneralRe: Control/Class Existence Pin
Heath Stewart11-Nov-03 3:36
protectorHeath Stewart11-Nov-03 3:36 
GeneralRe: Control/Class Existence Pin
Bhangorix11-Nov-03 23:55
Bhangorix11-Nov-03 23:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.