2013-10-10 49 views
2

我不是一個專業的程序員,只是一個學生誰想要了解更多關於如何找出我的代碼有什麼問題。我無法讓我的水晶報告出現在我的asp.net中,我有一個數據庫錯誤。我試圖改變服務器仍然不工作:「(水晶報告沒有顯示在asp.net上

這是我的第一個代碼:

ataAdapterpublic partial class Reports_Publisher : System.Web.UI.Page 
{ 
    SqlConnection con = new SqlConnection(Helper.GetCon()); 
--------------------------------------------------------------- 
    report.SetParameterValue("User", "--"); 
    crvpublisher.ReportSource = report; 
    crvpublisher.DataBind(); 
    con.Close(); 
    } 
} 

這裏是我的第二個代碼:

public partial class Reports_Publisher : System.Web.UI.Page 
{ 
SqlConnection con = new SqlConnection(Helper.GetCon()); 

report.SetParameterValue("User", Helper.GetData("userFN") + " " + 
    Helper.GetData("userLN")); 

    crvpublisher.ReportSource = report; 
    crvpublisher.DataBind(); 
    con.Close(); 
    } 

} 

我仍然得到我的asp.net數據庫錯誤:< 我確實有我的備份在我的SQL和它的工作適當y與服務器一起。我究竟做錯了什麼?我該怎麼辦?

+1

我刪除您在代碼中留下的數據庫的登錄信息。在公共網站上發佈這些內容並不是一個好主意。 –

回答

0

我相信你的SQL連接字符串是怪罪。我不知道是什麼Helper.GetCon()應該完成的,但傳統的連接字符串看起來更像是這樣的:

SqlConnection thisConnection = new SqlConnection(@"Server=(local)\sqlexpress;Integrated 
Security=True;" + "Database=DB"); 

看看這個網站here一些更多的例子。

希望幫助,

克里斯