以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 Dot NET,C#,ASP,VB 』  (http://bbs.xml.org.cn/list.asp?boardid=43)
----  初来驾到,有哪位高手能帮我解决下问题吗?我的数据库连接总是连不上,不知道为什么??  (http://bbs.xml.org.cn/dispbbs.asp?boardid=43&rootid=&id=30208)


--  作者:pucxin
--  发布时间:4/8/2006 6:50:00 PM

--  初来驾到,有哪位高手能帮我解决下问题吗?我的数据库连接总是连不上,不知道为什么??
asp.net的代码:
<%@ Page language="JavaScript" Codebehind="discussion.aspx.cs" AutoEventWireup="false" Inherits="discussion.discussion" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
 <HEAD>
  <title>discussion</title>
  <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
  <meta name="CODE_LANGUAGE" Content="C#">
  <meta name="vs_defaultClientScript" content="JavaScript">
  <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
 </HEAD>
 <body MS_POSITIONING="GridLayout">
  <form id="Form1" method="post" runat="server">
   <div id="contentListVisible" style="DISPLAY:none"></div>
   <FONT face="宋体"></FONT>&nbsp; <INPUT id="fabiao" style="Z-INDEX: 101; LEFT: 208px; WIDTH: 56px; POSITION: absolute; TOP: 456px; HEIGHT: 40px"
    type="submit" value="发表" runat="server">
   <asp:TextBox id="content" style="Z-INDEX: 102; LEFT: 192px; POSITION: absolute; TOP: 288px" runat="server"
    Width="353px" Height="124px"></asp:TextBox>
   <asp:DataGrid id="dg" style="Z-INDEX: 103; LEFT: 192px; POSITION: absolute; TOP: 144px"
    runat="server" Height="72px" Width="56px">
   </asp:DataGrid>
  </form>
 </body>
</HTML>

下面是他cs代码:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

namespace discussion
{
 /// <summary>
 /// discussion 的摘要说明。
 /// </summary>
 public class discussion : System.Web.UI.Page
 {
  protected System.Web.UI.HtmlControls.HtmlInputButton fabiao;
  protected System.Web.UI.WebControls.DataGrid dg;
  protected System.Web.UI.WebControls.TextBox content;

  
  
 
  private void Page_Load(object sender, System.EventArgs e)
  {
   // 在此处放置用户代码以初始化页面
   
   string CONNSTRING="Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=use;Data Source=PUCXIN;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=PUCXIN;Use Encryption for Data=False;Tag with column collation when possible=False";
   SqlConnection oConn=new SqlConnection(CONNSTRING);
   SqlCommand oCommand=new SqlCommand("discussion_fp",oConn);
   oCommand.CommandType=CommandType.StoredProcedure;
 
   oConn.Open();
   SqlDataAdapter adapt=new SqlDataAdapter();
   adapt.SelectCommand=oCommand;
   DataSet ds=new DataSet();
   adapt.Fill(ds);
   dg.DataSource=ds;
   dg.DataBind();
   oConn.Close();
  }
  
 
  #region Web 窗体设计器生成的代码
  override protected void OnInit(EventArgs e)
  {
   //
   // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
   //
   InitializeComponent();
   base.OnInit(e);
  }
  
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {    
   this.content.TextChanged += new System.EventHandler(this.content_TextChanged);
   this.fabiao.ServerClick += new System.EventHandler(this.fabiao_ServerClick);
   this.Load += new System.EventHandler(this.Page_Load);

  }
  #endregion

  private void fabiao_ServerClick(object sender, System.EventArgs e)
  {
 
  }
 
  
  private void content_TextChanged(object sender, System.EventArgs e)
  {
  
  }

 

   }
}


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
46.875ms