Showing posts with label password. Show all posts
Showing posts with label password. Show all posts

Monday, March 19, 2012

Choosing Data Type

Hi ... I have question on datatype on SQL Server 2005 EE

What is a good data type for email, password, Phone Number and ISBN number?

Thanks!I'd use varchar for all of those.|||Thanks for the reply. How about phone number? isn't that suppose to beNumeric? Or Numeric just for something that is calculateable?|||

iloveny:

Thanks for the reply. How about phone number? isn't that suppose to beNumeric? Or Numeric just for something that is calculateable?


You've hit the nail on the head. Only use numeric data types for something that is calculateable. Phone numbers, ZIP codes, etc. should definitely be one of the string data types (I suggest varchar).

Friday, February 24, 2012

checking password

i used this code to retrieve customer_ID from a database given a userid and password
how to retrieve the customer_ID
my code:
public static int CheckPassword(string userid,string pass)
{

SqlConnection conn=new SqlConnection(ConfigurationSettings.AppSettings["connString"]);
String strCheckPassword=@."Select Customer_ID from Customers Where UserID='" +userid+ "' "+"AND Password='"+pass+"'";
//name of the stored proceedure and command type set to StoredProceedure
SqlDataAdapter adp=new SqlDataAdapter(strCheckPassword,conn);
DataSet ds=new DataSet();
conn.Open();
adp.Fill(ds);
result=//this must retrieve customer_id from dataset ds; //help here

conn.Close();
return result;
}solved using Datareder get- method;