|
Use with database
|
Here you can see simple C# code of database use with Editor.
On initial Page load Editor content is getting from database, and is saving on postback.
| | |
void Page_Load(object o, EventArgs e){
OleDbConnection Connection = new OleDbConnection();
Connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
+Page.Server.MapPath("database/db.mdb") + ";";
Connection.Open();
if(Page.IsPostBack){
OleDbCommand myCommand;
string sqlString="Update tbTest Set fldContent=? Where id=?";
myCommand=new OleDbCommand(sqlString,Connection);
myCommand.Parameters.Add(new OleDbParameter("@fldContent",OleDbType.VarChar));
myCommand.Parameters["@fldContent"].Value=editor.Content; // save Editor content
myCommand.Parameters.Add(new OleDbParameter("@id",OleDbType.Integer));
myCommand.Parameters["@id"].Value = 1;
myCommand.ExecuteNonQuery();
}
else{
string sqlString="Select fldContent from tbTest Where id=1";
OleDbDataAdapter eAdapter=new OleDbDataAdapter(sqlString,Connection);
DataTable eTable = new DataTable();
OleDbCommandBuilder CommandBuilder = new OleDbCommandBuilder(eAdapter);
eAdapter.Fill(eTable);
editor.Content=(string)eTable.Rows[0][0]; // set Editor content
eAdapter.Dispose();
eTable.Dispose();
}
Connection.Close();
Connection.Dispose();
}
| | |
| "I must say the controls are awesome. I am very impressed with Scheduler component." |
Kris |
| Metis Systems |
| | |
|