如何使用visual studio Objects对sql server进行编程? [英] how to program the sql server with visual studio Objects ?

查看:41
本文介绍了如何使用visual studio Objects对sql server进行编程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问:如何使用visual studio Objects对sql server进行编程?



i我要求设计将在visual studio中,但代码将从中获取数据sql server(数据库)



喜欢





TextBox2.Text = yahoo.com;



就像在这个声明中一样TextBox.Text将放置在数据库中的某一行







谢谢



Tazz

解决方案

你必须连接数据库并获取所需数据并分配给控件



EX:绑定值 [ ^ ]





Begi nners指导通过C#访问SQL Server [ ^ ]


按照以下步骤操作....



  string  connetionString =  null ; 
SqlConnection cnn;
connetionString = 数据源= ServerName;初始目录= DatabaseName;用户ID =用户名;密码=密码
cnn = new SqlConnection(connetionString);
尝试
{
cnn.Open();
MessageBox.Show( Connection Open!);
cnn.Close();
}
catch (Exception ex)
{
MessageBox.Show( 无法打开连接!);
}





完整源代码... C# Sql Server Connection



Caron


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

解决方案

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#[^]


Follow these steps....

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


这篇关于如何使用visual studio Objects对sql server进行编程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆