PDA

View Full Version : Working with SQL Server


infiniteLoop
06-25-2005, 03:51 AM
Hi, i'm kinda new to ASP, especially when it comes to database.

I have 2 questions about SQL server. First, what should i do about allowing NULL values when designing the database? What difference does it make? And if I disallow NULL values, should i enter default values?

Second, when adding new records to database with recordset.addnew, what SELECT statment, cursor, and lock type should i use.
I've always used "SELECT * FROM Table" and adOpenStatic, and adLockOptimistic. This SELECT statement looks very inefficient to me, but I don't know what else to use.

Please help me out, thanx.

Morgoth
06-26-2005, 04:00 AM
If you don't allow NULL values then you should have a default value. That way if information is not entered in the user submited form then you don't get errors.



I came across this helpful site in my bookmarks yestarday (as I was cleaning them out) This will help with your SQL statements, but for the other stuff, I am sorry, I don't know. CLICK ME (http://nparikh.freeshell.org/unix/mysql.php)

miranda
06-26-2005, 04:09 PM
[list=1]
If you don't allow NULL values then you should have a default value. That way if information is not entered in the user submited form then you don't get errors.



This is where validation comes in. You should do it both on the client side with javascript and also on the server side (just in case the user has javascript disabled).


As to using ADO to add the record, why not just do so with a SQL INSERT statement? It is much faster and uses less resources to do so.