hi, I know usung the wizards this is damn easy but i need to do this from code: I have written this code in my DAL to retrreive A record by user name... i need to re-write the code to handle optimistic concurrecny.... could any one give me few pointer or modification to my code:
To start with, I like your PM, pure code is always better in that you
have all the control you need and I never use databound controls, way
too many problems with them. I have never needed to use stored procs
so this part I am not that familiar with.
Do you have an email address I can send you some code?
This
is one function in the class I will send you, it executes queries -
insert, update or delete to run stored procs you could send this
function something like this - execSQL("EXECUTE(stored_proc_name)" );
Do you want this to be PURE code or are you using databound controls to do most of your work?
If you want this to be pure code then the preparation will be time consuming but when all things are in place, your work flow will be rapid and a little easier.
Is there a reason why you are using stored procedures for this task? Sometimes stored procedures take longer than straight queries.
There are Ups and Downs for both, does your application really need stored procs?
Do you really need a DataSet or do you just want the user record in text boxes?
petre ricardo155 reputationPosted Oct 30, 2009, 7:01 PM EDT
0
HI Lizard,
Thanks for the reply...I have put my answers underneath your questions! :)
Q: Do you want this to be PURE code or are you using databound controls to do most of your work?
A: I need to do this primary in pure code, but i would also love to know how to do this by databounds...reasons for pure code most of the time my PM asks forpure code
Q: Is there a reason why you are using stored procedures for this task? Sometimes stored procedures take longer than straight queries.
A: PM insists on SP
Q: There are Ups and Downs for both, does your application really need stored procs?
A: Application doesnt but my PM does!
Q: Do you really need a DataSet or do you just want the user record in text boxes?
A: Would love to know both :)
petre ricardo155 reputationPosted Nov 1, 2009, 1:16 AM EST
0
you have asked me to send my email address so that you can send the code...
So i've used the contact user option to send my email address anyway...
But i have received a reply .... TY for the code :)
Petre
theLizardRank #1,079 · 1.8K reputationPosted Oct 30, 2009, 10:12 PM EDT
Do you have an email address I can send you some code?
This is one function in the class I will send you, it executes queries - insert, update or delete to run stored procs you could send this function something like this - execSQL("EXECUTE(stored_proc_name)" );
//-----------------------------------------------------------------
public bool execSQL(string s)
{
bool success = true;
sqlCon con = new sqlCon();
try
{
con.connect();
con.command(s);
con.beginTrans();
con.write();
con.commitTrans();
}
catch (Exception err)
{
con.rollbackTrans();
success = false;
}
finally
{
con.terminate();
}
return (success);
}
//-----------------------------------------------------------------
other functions allow you to easily get fields from returned result set and populate text boxes etc.
functions like get("field_name") would be used like this TextBox1.text = con.get("CustomerName");
other syntax - to load combo boxes
while(con.read())
{
ComboBox1.Items.Add(con.get("CustomerName"));
}
Does this make sense.
theLizardRank #1,079 · 1.8K reputationPosted Oct 30, 2009, 1:22 PM EDT
If you want this to be pure code then the preparation will be time consuming but when all things are in place, your work flow will be rapid and a little easier.
Is there a reason why you are using stored procedures for this task? Sometimes stored procedures take longer than straight queries.
There are Ups and Downs for both, does your application really need stored procs?
Do you really need a DataSet or do you just want the user record in text boxes?
If you are just reading data and not making changes then Optimistic or Pessamistic concurrency should not be of concern.
In pure code you would control all aspects of connecting, opening and updating records in your tables.
petre ricardo155 reputationPosted Oct 30, 2009, 7:01 PM EDT
Thanks for the reply...I have put my answers underneath your questions! :)
Q: Do you want this to be PURE code or are you using databound controls to do most of your work?
A: I need to do this primary in pure code, but i would also love to know how to do this by databounds...reasons for pure code most of the time my PM asks forpure code
Q: Is there a reason why you are using stored procedures for this task? Sometimes stored procedures take longer than straight queries.
A: PM insists on SP
Q: There are Ups and Downs for both, does your application really need stored procs?
A: Application doesnt but my PM does!
Q: Do you really need a DataSet or do you just want the user record in text boxes?
A: Would love to know both :)
Thank you!
petre ricardo155 reputationPosted Oct 31, 2009, 7:25 PM EDT
theLizardRank #1,079 · 1.8K reputationPosted Oct 31, 2009, 9:47 PM EDT
petre ricardo155 reputationPosted Nov 1, 2009, 1:16 AM EST
So i've used the contact user option to send my email address anyway...
But i have received a reply .... TY for the code :)
Petre