Click here to Skip to main content
15,915,019 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
ques : how to program the sql server with visual studio Objects ?

i am asking that the design will be in visual studio but code will be get data from the sql server (database)

like


TextBox2.Text="yahoo.com";

like in this statement TextBox.Text will be place by some row from the database



Thanks

Tazz
Posted
Updated 11-Aug-14 21:07pm
v2
Comments
[no name] 10-Aug-14 14:20pm    
http://www.codeproject.com/Articles/4416/Beginners-guide-to-accessing-SQL-Server-through-C

You have to connect with data base and fetch the required data and assign to the controls

EX : Bind Values[^]


Beginners guide to accessing SQL Server through C#[^]
 
Share this answer
 
Comments
gursagar 11-Aug-14 8:56am    
Dear i have asking that i have to initialize the object of the Visual studio from the sqldatabase so that i can configure the TextBox Switching from database
Follow these steps....

C#
string connetionString = null;
SqlConnection cnn ;
connetionString = "Data Source=ServerName;Initial Catalog=DatabaseName;User ID=UserName;Password=Password"
cnn = new SqlConnection(connetionString);
try
{
    cnn.Open();
    MessageBox.Show ("Connection Open ! ");
    cnn.Close();
}
catch (Exception ex)
{
    MessageBox.Show("Can not open connection ! ");
}


Full Source code...C# Sql Server Connection

Caron
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900