4 Answers, 1 is accepted
The easiest way to achieve this is explained in our help topic Declarative Data Binding and especially step 6 where it is explained how to autogenerate the Insert/Update /Delete statements.
Hope this will help you.
Greetings,
Plamen Zdravkov
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
thank u for your reply can not i understand any think for Explanation
what it's mean resource type
i uswe this code for binding scheduler
Dim daadabterch As New SqlDataAdapter("select * from tbl_appointments", con)
Dim dssh As New DataSet
Try
con.Open()
daadabterch.Fill(dssh,
"tbl_appointments")
con.Close()
RadScheduler2.DataSource = (dssh)
RadScheduler2.DataMember =
"tbl_appointments"
RadScheduler2.DataKeyField =
"ID"
RadScheduler2.DataStartField =
"start"
RadScheduler2.DataEndField =
"end"
RadScheduler2.DataSubjectField =
"subject"
RadScheduler2.DataBind()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
how can i user insert statment for insert data into DB SQL
thank u admin
You may also take a look at our Using The Data Source Property help topic.
If you need to update the appointments data source, you should handlethe AppointmentUpdate/Insert/Delete events. You can refer to the DataBase provider demo and see how the data source is manipulated on those events.
publicoverridevoidInsert(RadScheduler owner, Appointment appointmentToInsert)
{
if
(!PersistChanges) {
return
;
}
using
(DbConnection conn = OpenConnection())
{
using
(DbTransaction tran = conn.BeginTransaction())
{
DbCommand cmd = DbFactory.CreateCommand();
cmd.Connection = conn;
cmd.Transaction = tran;
PopulateAppointmentParameters(cmd, appointmentToInsert);
cmd.CommandText =
@" INSERT INTO [DbProvider_Classes]
([Subject], [Start], [End], [TeacherID],
[RecurrenceRule], [RecurrenceParentID], [Reminder])
VALUES (@Subject, @Start, @End, @TeacherID,
@RecurrenceRule, @RecurrenceParentID, @Reminder)";
if
(DbFactory isSqlClientFactory)
{
cmd.CommandText += Environment.NewLine +
"SELECT SCOPE_IDENTITY()"
;
}
else
{
cmd.ExecuteNonQuery();
cmd.CommandText =
"SELECT @@IDENTITY"
;
}
intidentity = Convert.ToInt32(cmd.ExecuteScalar());
FillClassStudents(appointmentToInsert, cmd, identity);
tran.Commit();
}
}
}
publicoverridevoidUpdate(RadScheduler owner, Appointment appointmentToUpdate)
{
if
(!PersistChanges)
{
return
;
}
using
(DbConnection conn = OpenConnection())
{
using
(DbTransaction tran = conn.BeginTransaction())
{
DbCommand cmd = DbFactory.CreateCommand();
cmd.Connection = conn;
cmd.Transaction = tran;
PopulateAppointmentParameters(cmd, appointmentToUpdate);
cmd.Parameters.Add(CreateParameter(
"@ClassID"
, appointmentToUpdate.ID));
cmd.CommandText =
"UPDATE [DbProvider_Classes] SET [Subject] = @Subject, [Start] = @Start, [End] = @End, [TeacherID] = @TeacherID, [RecurrenceRule] = @RecurrenceRule, [RecurrenceParentID] = @RecurrenceParentID WHERE [ClassID] = @ClassID"
;
cmd.ExecuteNonQuery();
ClearClassStudents(appointmentToUpdate.ID, cmd);
FillClassStudents(appointmentToUpdate, cmd, appointmentToUpdate.ID);
tran.Commit();
}
}
}
publicoverridevoidDelete(RadScheduler owner, Appointment appointmentToDelete)
{
if
(!PersistChanges)
{
return
;
}
using
(DbConnection conn = OpenConnection())
{
DbCommand cmd = DbFactory.CreateCommand();
cmd.Connection = conn;
using
(DbTransaction tran = conn.BeginTransaction())
{
cmd.Transaction = tran;
ClearClassStudents(appointmentToDelete.ID, cmd);
cmd.Parameters.Clear();
cmd.Parameters.Add(CreateParameter(
"@ClassID"
, appointmentToDelete.ID));
cmd.CommandText =
"DELETE FROM [DbProvider_Classes] WHERE [ClassID] = @ClassID"
;
cmd.ExecuteNonQuery();
tran.Commit();
}
}
}
Greetings,
Plamen Zdravkovthe Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!