In my project, I have all database connectivity established in my aspx.cs page. I want to move all calls to the database to a class called DatabaseAccess. I am repeating calls to the database throughout my code and this would simplify things.
I have code written to open the connection and it is working fine. I am now lost on what to do next. I need to establish my cmd object and parameters through my class as well. Here is my code on my aspx.cs page where I am declaring the command and adding the parameters.
I am also including my DataAccess class where I have included my open connection. Can anyone tell me where to start. I am new to asp.net and c#, this is the first class that I have written. Any help would be GREAT!!
//Declare connection object
SqlConnection Conn = new SqlConnection();
string sError = "";
if (dac.OpenSqlConnection(ref Conn, strConn, out sError) == false)
lblMessage.Text = "Error Connection to Database: " + sError;
string sql = "UPDATE Customer SET FirstName=@FirstName, LastName=@LastName, Email=@Email, Password=@Password, Address1=@Address1, Address2=@Address2, City=@City, State=@State
View Complete Post