|
Suppose you're making a site with a registration module, I'm doing this with DeKlarIT
step 1 - customer enters e-mail addy
step 2 - customer is e-mail verfied
step 3 - customer enters financial details
step 4 - customer's financial details are verified
step 5 - customer enters in advanced details
step 6 - adavanced details verified
...
you've got to keep track of what stage is the customer in, what do you do - create a status integer field which stores values 0-n or create lots of boolean fields.. this question applies to db and your classes
|
|
|
|
|
I don't see what this has to do with a database other than the data being entered is going in and out of a database. Surely the tracking infomation is a part of the web application. I suppose you could put it in the database if you want to give the user the option of returning to where they left off if this is a particularly long operation.
It depends on the functionality that you want which you should used. If you use an integer then it assumes that everything before it is completed and correct. If you use a set of booleans then you could give the the user the possibility of jumping around the pages in the order they choose, but the implementation will be more complex.
Also, this smells like a homework question. You're going to have to make your own decision on this one.
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
it already occured to me that lots of booleans would mean the user could hop through the pages in any order but let me rephrase the question, although both methods are acceptable, which method would be more elegant to code
Take the first example -
you have a field in the db called status which is a integer and you have a enum in your code, take the other situations, after running a code generation tool on the db you have flags like User.Registration.IsEmailActivated, User.Registration.IsDataActivated, User.Registration.IsRegistered
|
|
|
|
|
|
Hi, can anyone bring more insight as to make db access thread-safe programmatically? i.e. if there are multithreaded programme or even several programmes trying to access a same db, what do you guys usually do to prevent them conflicting each other?
|
|
|
|
|
Let the database sort it out. So long as you follow the following rules you shouldn't run into many problems:
* Ensure that things are transacted properly.
* Access the tables in the same order for each function. e.g. If some function access table A, B, and D and another function access tables B, C and D ensure that they are accessed in the order A, B, C, and D because if the first function accesses tables in the order D, B and A and the second function access the tables in the order B, C and D then you could run into deadlock. The first function locks table D, meanwhile the second function locks table B, the first function then wants to access table B but can't so it waits for the lock to be released. The second function then gets table C and then requests table D but it cannot because it is locked. The second function then waits for the lock on table D to be released. Now both functions cannot complete until the other has - they are deadlocked. The database will detect this and rollback one of the queries (the deadlock victim). Your application can then attempt again to run function that was the deadlock victim.
My: Blog | Photos
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More
|
|
|
|
|
thx! I was using mutex and 'd been doing locking in the code. Looks like it is unneccessary.
|
|
|
|
|
Use transactional error handling with sql server. Do this especially if you are upating tables that have a related tables.
Declare @intErrorCode int
select @intErrorCode = @@Error
begin transaction
If @intErrorCode = 0
begin
-- insert SQL Statement
set @intErrorCode = @@Error
end
If @intErrorCode = 0
begin
-- insert another SQL Statement
set @intErrorCode = @@Error
end
IF @Error = 0
commit transaction
else
rollback transaction
return @Error
"People who never make mistakes, never do anything."
My blog
http://toddsnotsoamazinglife.blogspot.com/
|
|
|
|
|
Can NHibernate call stored procedure? I read NHibernate reference doc, doesn't look like it's there, am I right about this?
Norman Fung (c)
|
|
|
|
|
hi,
I am using
VisualStudio2003,
Access2003
Vb.Net and ADO.Net for db access.
I get this message when i try to use ExecuteReader method :
IErrorInfo: GetDescription failed with E_FAIL( some hexvalue )
Now i tried MSDN it says GetDescription supposed to return description of error that is generated by database.
This is what I am doing:
I have a table called section
g_AdoCon = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" + db)
//checked the db variable, it is valid path and everything and this
// conenction works in another class fine
If g_AdoCon.State = ConnectionState.Closed Then
g_AdoCon.Open()
End If
m_Command = New OleDbCommand
m_Command.Connection = g_AdoCon
query = "Select * from section where cls_id = 3"
m_Command.CommandText = Query
m_Reader = m_Command.ExecuteReader(CommandBehavior.CloseConnection)
the exception is raised when m_Command.ExecuteReader is executed.
Am really stuck on this, sionce MSDN didn't really help and i have no idea what that exception means.
Pleas help!
|
|
|
|
|
So what was the hex value -- have you tried to look it up in the KB?
How and where is m_reader declared?
Have you tried putting a try -catch around the ExecuteReader and printing the error description in the catch block?
dumping the stack trace?
It would appear that you have only provided selected parts of your code...
maybe a cut/paste of the whole thing would shed some light.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
"So what was the hex value -- have you tried to look it up in the KB"
0x80004005 - E_FAIL. Microsoft says underlying component did not had a specific error number for encountered error. It happens for a lot of things but nothing specific for ADO. jsut means a general failure. How ever i found a similar problem on net on this query.
"Select * from mytable where language = 'EN'"
The problem got solved when authormodified the query to
"select * from mytable where [LANGUAGE] = 'EN'"
apparently ado treated language as keyword.( thatw as the cause given ). But this dosn't work in my case and am totally lost.
Rob Graham wrote:
Have you tried putting a try -catch around the ExecuteReader and printing the error description in the catch block?
dumping the stack trace?
AI got the error message by using the try catch, so answer is yes. dumping the stack trace????dunno what u mean here.
Rob Graham wrote:
How and where is m_reader declared?
m_reader is decalred a private member of the class in which all this is happening as
Private m_Reader As OleDbDataReader
Rob Graham wrote:
It would appear that you have only provided selected parts of your code...
maybe a cut/paste of the whole thing would shed some light.
cut paste whole class??? well it never gets past this point so i dunno if pasting the rest of code is nay use at all, cuz it has nothing to do with this.
Randhawa
|
|
|
|
|
since the reader is a private member, rather than a local variable, I presume you are reusing it in other functions. Did you remember to close the reader each time you were through with it (closing the connection might not be enough)? As a general rule, I create datareaders as local variables, rather than members, and close them after each use.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
yeah it's getting closed after am done with it, every time.
Actually it has never reached to the closing point yet, since the executereader never got executed since i wrote it.
|
|
|
|
|
is the datareader null, after the execute attempt?
You don't close it in a finally block to insure it is closed even if an exception is thrown? (the fact that it thew an exception doesn't necessarily mean that it is properly closed...)
Have you tried creating the reader as a local variable inside the function?
I'n not sure why you chect the connection state to see if it is closed before trying to open it, since you just created it with a New...hve you single stepped the code to see if the connection really gets opened?
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
Well first of all it's very common to use ACCESS keywords as fields or tables names and cause the ACCESS to do something strange!!!
Try "SELECT * FROM [Section] WHERE [cls_id]=3" instead.
Second,Why are you using CommandBehavior.CloseConnection?
if you want to close your connection you can do it using connection object itself(I'm not familiar with CommandBehavior but I prefer to do one job at a time first create the reader then close the connection)
|
|
|
|
|
The problem was with the Query. Section seemed to have problems, and putting it in [ ] brackets didn't help either. I changed the name of the table to Sections and everything is working fine.
Thanks for all you guys help
|
|
|
|
|
Hi, I’m trying to find something about object/relation using xml, a design patterns or good strategies.
This must be quite common, but its still hard to find information about this area.
|
|
|
|
|
I think you should be looking for DiffGrams in DataSets.
Live Life King Size
Alomgir Miah
|
|
|
|
|
Hi,
I need to know if you are able to access an Access database across networks? I have my ASP code at one hosting company in the states, and the Access database is at another hosting company in South Africa. They are not on the same networks.
A colloeague of mine says this is not possible because Access is a file driven database.
Any help will be appreciated!!
Thanks.
|
|
|
|
|
Brendan Vogt wrote:
I need to know if you are able to access an Access database across networks?
??? what do i hear ? Access DataBase ?
what a good joke !!
no, seriously, access, is not a database as SQL server, Oracle, mySQL, are...
consider seriously revising your need of using such software...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
You might be able to use a UNC file path to the database (this works on a local lan, provided the user has access to the directory). It will be slow however, and is not likely to prove satisfactory (performance wise), if it works at all.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
In vs.net 2005, I want to connect with MySQL database.
After trying some hours, I found there is many questions:
1 Add reference error.
Which dll should be add into project?
2 Connect String error.
Which provider in OLEDB could be used?
3 User name and password and datasource.
Thanks!
|
|
|
|
|
OLE DB Provider for mySQL
oConn.Open "Provider=MySQLProv;" & _
"Data Source=mySQLDB;" & _
"User Id=myUsername;" & _
"Password=myPassword"
|
|
|
|
|
I use the provider "MySQLProv",but the .net 2005 beta2 said "the provider is not registered on the local machine.
|
|
|
|