I'm going to edit textbox value.. but i saw there's a problem
protected void btn_edit_Click(object sender, EventArgs e)
{
DatabaseConnector con = new DatabaseConnector().CreateInstance();
SqlCommand com = new SqlCommand("UPDATE tbl_BinCardManager SET ItemName = @ItemName WHERE ItemNo = @ItemNo");
com.Parameters.Add("@ItemName",sqlDbType.VarChar);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
ERROR 1:
The name 'sqlDbType' does not exist in the current context
ERROR 2:
'ERPSystem.DatabaseConnector' does not contain a definition for 'Open' and no extension method 'Open' accepting a first argument of type 'ERPSystem.DatabaseConnector' could be found (are you missing a using directive or an assembly reference?)
My DBConnector Class is :
class DatabaseConnector
{
private DatabaseConnector databaseConnector;
private string connectionString = "Data Source=lernlap;Initial Catalog=ERPSystemDB;User ID=sa;Password=sa123";
public DatabaseConnector()
{
}
private SqlConnection connection;
private bool Connect()
{
try
{
connection = new SqlConnection(connectionString);
connection.Open();
return true;
}
catch(Exception) {
return false;
}
}
internal DatabaseConnector CreateInstance()
{
if (databaseConnector == null)
{
databaseConnector = new DatabaseConnector();
databaseConnector.Connect();
}
return databaseConnector;
}