public static DataTable getLogUser(String usn, String ps) { String sql = "Select * from [User] where UserName = '******' and Password = '******'"; return(DAO.GetDataTable(sql)); }
public static bool insertRegister(TextBox[] t1, TextBox[] t2) { // only auto for guest user String sql = "INSERT INTO [dbo].[User]" + Environment.NewLine + " ([UserName]" + Environment.NewLine + " ,[Password]" + Environment.NewLine + " ,[FirstName]" + Environment.NewLine + " ,[LastName]" + Environment.NewLine + " ,[Address]" + Environment.NewLine + " ,[City]" + Environment.NewLine + " ,[State]" + Environment.NewLine + " ,[Country]" + Environment.NewLine + " ,[Phone]" + Environment.NewLine + " ,[Email]" + Environment.NewLine + " ,[type])" + Environment.NewLine + " VALUES" + Environment.NewLine + " (@UserN ,@Psw,@fN,@lN,@addr,@city,@state ,@country,@phone,@email, 1)"; SqlCommand com = new SqlCommand(sql); com.Parameters.AddWithValue("@UserN", t1[0].Text); com.Parameters.AddWithValue("@Psw", t1[1].Text); com.Parameters.AddWithValue("@fN", t1[2].Text); com.Parameters.AddWithValue("@lN", t1[3].Text); com.Parameters.AddWithValue("@email", t1[4].Text); if (t2[0].Text == string.Empty) { com.Parameters.AddWithValue("@addr", DBNull.Value); } else { com.Parameters.AddWithValue("@addr", t2[0].Text); } if (t2[1].Text == string.Empty) { com.Parameters.AddWithValue("@city", DBNull.Value); } else { com.Parameters.AddWithValue("@city", t2[1].Text); } if (t2[2].Text == string.Empty) { com.Parameters.AddWithValue("@state", DBNull.Value); } else { com.Parameters.AddWithValue("@state", t2[2].Text); } if (t2[3].Text == string.Empty) { com.Parameters.AddWithValue("@country", DBNull.Value); } else { com.Parameters.AddWithValue("@country", t2[3].Text); } if (t2[4].Text == string.Empty) { com.Parameters.AddWithValue("@phone", DBNull.Value); } else { com.Parameters.AddWithValue("@phone", t2[4].Text); } return(DAO.UpdateTable(com)); }
public static DataTable getAllArtist() { String sql = "SELECT * FROM Artists"; return(DAO.GetDataTable(sql)); }