TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
albert albert
NA
524
0
How to load Automatically a database
Sep 5 2013 8:07 AM
Hi,
That if you select and connectionstring that the database will automatically be loaded with a specific table - in this case: TripElement. Because I have it now hard coded, like this:
private string _connectionString = @"server=DEV12;database=prod_CycleTours_net2_backup_201107110300;uid=sa;pwd=misoft;";
I have a listbox with a list of connectionstrings and if you select an connectionstring from the listbox then automatically the database with the specific column will be loaded
I triied like this:
[code]
private void btn_SelectDatabase_Click(object sender, EventArgs e)
{
using (var _connectionString = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString))
using (var command = connection.CreateCommand())
{
command.CommandText = "SELECT ColumnName FROM [check]";
connection.Open();
using (var reader = command.ExecuteReader())
{
while (reader.Read())
txtConfigurationName.Text = reader["TripElement"].ToString();
}
}
}
[/code]
Reply
Answers (
2
)
How to break a program before called to Main()?
select query for three joined table?