当前位置:编程学习 > C#/ASP.NET >>

ASP.NET编程里的查询

1. 请问如何实现对SQL的连接和查询 要有具体的代码 2. 查询后的数据如何写到文本框中 要有具体的代码
补充:我用的是ASP.NET,不是VB.NET或是其它的
答案:c#  sqlserver
string connectionstring = "Server= ;database= ; uid= ;pwd=";
SqlConnection conn = new SqlConnection(connectionstring);
conn.open();
SqlCommand cmd = new SqlCommand("select column2 from table where column1=?");
SqlDataReader dr = cmd.ExecuteReader();
this.textbox1.text = dr["columnname"].tostring();// 一个文本

conn.close();
这是最简单的。
希望可以帮到你!
其他:http://chs.gotdotnet.com/quickstart/aspplus/doc/webdataaccess.aspx

看了就明白了 ASP.NET 也分语言的 
我用的是 VB语言 

上一个:asp.net编程,怎么就实现前后台分离呢?
下一个:asp.net开发工程师工资怎么样?会html,css,js,css+div和div+table布局,会oop思想,C#程序设计,ajax,fi

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,