⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 visual c#的sql server编程.htm

📁 Visual C#的SQL Server编程
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0039)http://study.qqcf.com/web/225/24068.htm -->
<HTML><HEAD><TITLE>Visual C#的SQL Server编程</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="Visual C#的SQL Server编程" name=keywords>
<META content="Visual C#的SQL Server编程" name=Description><LINK 
href="Visual C#的SQL Server编程.files/style.css" type=text/css rel=stylesheet>
<META content="MSHTML 6.00.2900.3268" name=GENERATOR></HEAD>
<BODY leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<TABLE cellSpacing=0 cellPadding=0 width=776 align=center border=0>
  <TBODY>
  <TR>
    <TD bgColor=#000000 colSpan=3><IMG height=1 
      src="Visual C#的SQL Server编程.files/spacer.gif" width=1></TD></TR>
  <TR>
    <TD width=1 bgColor=#000000><IMG height=1 src="" width=1></TD>
    <TD class=tdc height=10><IMG height=1 src="" width=1></TD>
    <TD width=1 bgColor=#000000><IMG height=1 src="" 
width=1></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=776 align=center bgColor=#ffffff 
border=0>
  <TBODY>
  <TR>
    <TD width=1 bgColor=#000000 height=12><IMG height=1 src="" width=1></TD>
    <TD class=tdc width=10><IMG height=1 src="" width=1></TD>
    <TD><IMG height=1 src="" width=1></TD>
    <TD width=40><SPAN id=tdimg_1></SPAN></TD>
    <TD class=tdc width=200><IMG height=1 src="" width=1></TD>
    <TD width=1 bgColor=#000000><IMG height=1 src="" 
width=1></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=776 align=center bgColor=#ffffff 
border=0>
  <TBODY>
  <TR>
    <TD width=1 bgColor=#000000><IMG height=1 src="" width=1></TD>
    <TD class=tdc width=10><IMG height=1 src="" width=1></TD>
    <TD width=14><IMG height=1 src="" width=1></TD>
    <TD>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
        <TR>
          <TD width=160><A href="http://study.qqcf.com/" target=_blank><IMG 
            height=60 alt=ASP,ASP.NET,PHP,JSP,源码,教程,特效 
            src="Visual C#的SQL Server编程.files/logo.gif" width=160 
          border=0></A></TD>
          <TD>
            <SCRIPT src="Visual C#的SQL Server编程.files/1.js"></SCRIPT>
          </TD></TR></TBODY></TABLE></TD>
    <TD class=tdc width=10><IMG height=1 src="" width=1></TD>
    <TD width=1 bgColor=#000000><IMG height=1 src="" 
width=1></TD></TR></TBODY></TABLE>
<TABLE height=6 cellSpacing=0 cellPadding=0 width=776 align=center 
bgColor=#ffffff border=0>
  <TBODY>
  <TR>
    <TD width=1 bgColor=#000000><IMG height=1 src="" width=1></TD>
    <TD class=tdc width=10><IMG height=1 src="" width=1></TD>
    <TD><IMG height=1 src="" width=1></TD>
    <TD class=tdc width=10><IMG height=1 src="" width=1></TD>
    <TD width=1 bgColor=#000000><IMG height=1 src="" 
width=1></TD></TR></TBODY></TABLE>
<SCRIPT src="Visual C#的SQL Server编程.files/menu.js"></SCRIPT>

<SCRIPT src="Visual C#的SQL Server编程.files/2.js"></SCRIPT>

<TABLE height=12 cellSpacing=0 cellPadding=0 width=776 align=center 
bgColor=#ffffff border=0>
  <TBODY>
  <TR>
    <TD width=1 bgColor=#000000><IMG height=1 src="" width=1></TD>
    <TD class=tdc width=10><IMG height=1 src="" width=1></TD>
    <TD><IMG height=1 src="" width=1> 
      <TABLE cellSpacing=0 cellPadding=0 width="98%" align=center border=0>
        <TBODY>
        <TR>
          <TD height=20>当前位置:<A href="http://study.qqcf.com/" 
            target=_blank>首页</A>&gt;&gt;<A 
            href="http://study.qqcf.com/corps/52/list_1.htm" 
            target=_blank>C#语言</A>&gt;&gt;<A 
            href="http://study.qqcf.com/sort/225/list_2_1.htm" 
            target=_blank>C#数据库编程</A></TD></TR>
        <TR>
          <TD bgColor=#e8e8e8 height=30>
            <DIV align=center><FONT color=#ff0000 size=4><STRONG>Visual C#的SQL 
            Server编程</STRONG></FONT></DIV></TD></TR>
        <TR>
          <TD>
            <P>
            <P><B>初始设置</B></P>
            <P>首先,我们需在应用系统中安装SQL Server 2000,Microsoft OLE DB Provider for SQL 
            Server (SQL OLE DB)也会同时被自动安装,接着用SQL Server的Enterprise 
            Manager创建一个叫tyjdb的数据库,并新建一名为address的数据表,其含name、email、age和address四个字段。 
            <BR><BR>打开VS开发环境中的视图选单项中的服务器资源管理器,该管理器可管理SQL Server及其他各种OLE 
            DB的数据库连接,并可以管理其中的数据。接着我们添加一个新的数据连接,连接属性选择Microsoft OLE DB Provider 
            for SQL server,然后选好服务器及数据库tyjdb,测试连接成功后按确定。使用该工具可又快又准地生成需要的数据库连接字符串。 
            <BR><BR><B>连接数据库</B> </P>
            <P>新建一个ASP.NET项目或Windows.NET应用程序,因为二者的数据库存取程序是相同的。将服务器资源管理器中的数据连接拖至新建的Web 
            Form上即可,这时自动生成了一个连接字符串如下:</P>
            <TABLE cellSpacing=0 borderColorDark=#ffffff cellPadding=0 width=580 
            align=center borderColorLight=black border=1>
              <TBODY>
              <TR>
                <TD class=code 
                  bgColor=#e6e6e6>this.sqlConnection1.ConnectionString<BR><BR>= 
                  "data source=WHOAMI;<BR><BR>initial 
                  catalog=tyjdb;<BR><BR>integrated security=SSPI;<BR><BR>persist 
                  security info=False;<BR><BR>workstation 
                  id=WHOAMI;<BR><BR>packet 
                size=4096";<BR><BR>其中WHOAMI为笔者的服务器名。</TD></TR></TBODY></TABLE>
            <P>选取工具箱中的SqlDataAdapter并拖至该Web 
            Form,提示时选取tyjdb的数据连接,选择使用SQL语句访问数据库,生成SQL语句时只填入SELECT

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -