This is a migrated thread and some comments may be shown as answers.

How to connect to database at runtime

2 Answers 121 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Atle
Top achievements
Rank 1
Atle asked on 10 Jul 2009, 01:08 AM
Hi,
I am new to Telerik controls so don't understand all of the consepts yet. I have been playing with the Scheduler since it is the first component I need to implement.
I have a SQL Server and I used the datasource wizzard to connect. Things are working just fine. But my real life application needs to connect to many different databases with the exact same structure at run time depending on logged in user (I have several users and each of them have their own database on the same server).

So my question is how can I override the connectionstring (or some other method) in code behind to change the database name just before the Scheduler loads?

Atle

2 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 10 Jul 2009, 12:43 PM
Hello Atle,

Here is one idea:

1. You have an SQL Datasource set up on the page (e.g. the Select, Update, Insert and Delete queries are there).

2. You have RadSCheduler on the same page - all settings are set except the DataSourceID property.

3. In Page_Load of the page you set the connection string of the datasource, set the DataSourceID property of the Scheduler to point to that datasource and call the DataBind() method of the scheduler.

I hope this will get you started.

Greetings,
Veselin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Michael
Top achievements
Rank 1
answered on 14 Feb 2011, 11:57 AM
Hi

I'll use Data binding (DataSource property) with custom Advanced form embeded into a RadWindow - customized editing form(s); also I want to alter database structure in this manner:
- In Appointments table: will transform ID type from int to Guid; therefore Appointment business object will have the ID as Guid so is there any issue with binding Scheduler with custom objects? Should I espect unusual behavior in displaying information in RadScheduler?

Thanks
Dan
Tags
Scheduler
Asked by
Atle
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Michael
Top achievements
Rank 1
Share this question
or