public void updateData(doctor doc) { string connectionString = @"Data Source=cdb.c1lbyzt9l8fn.us-west-2.rds.amazonaws.com,1433;" + "Initial Catalog=cis;" + "User id=sonaaaa;" + "Password=mo7senzzzz;"; SqlConnection myConnection = new SqlConnection(connectionString); myConnection.Open(); SqlCommand myCommand = new SqlCommand(); myCommand.CommandText = "UPDATE doctorAccounts SET PNumber ='" + doc.getPNumber() + "',Email ='" + doc.getEmail() + "', Password ='******', FName = '" + doc.getFname() + "', LName = '" + doc.getLname() + "', fees = '" + doc.getFees().ToString() + "' WHERE id = " + doc.getID() + ";"; myCommand.Connection = myConnection; myCommand.ExecuteNonQuery(); myConnection.Close(); }
public void insertData(doctor doc) { string connectionString = @"Data Source=cdb.c1lbyzt9l8fn.us-west-2.rds.amazonaws.com,1433;" + "Initial Catalog=cis;" + "User id=sonaaaa;" + "Password=mo7senzzzz;"; SqlConnection myConnection = new SqlConnection(connectionString); myConnection.Open(); SqlCommand myCommand = new SqlCommand(); myCommand.CommandText = "insert into doctorAccounts (PNumber,Email,Password,FName,LName,fees) Values ('" + doc.getPNumber() + "','" + doc.getEmail() + "','" + doc.getPassword() + "','" + doc.getFname() + "','" + doc.getLname() + "','" + doc.getFees().ToString() + "') ; "; myCommand.Connection = myConnection; myCommand.ExecuteNonQuery(); myConnection.Close(); }