Click here to Skip to main content
15,888,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have following connection string that wont work when i run the page in debug mode it just writes the connection string on the page thanks


XML
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
          ConnectionString="System.Data.SqlClient"/>ng="< connectionString="xxx.xx.xxx.xxx;Database=xxx;Uid=xxxx;Password=xxxx;
          providerName="System.Data.SqlClient"/> SelectCommand="SELECT * FROM [waiting]"
          onselecting="SqlDataSource1_Selecting">
      </asp:SqlDataSource>
Posted

hi ,

Please try this kind of string

ASP.NET
<asp:sqldatasource id="SqlDataSource1" runat="server" xmlns:asp="#unknown">
                        ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" 
                        
                        SelectCommand="SELECT GETDATE() Date, CategoryID, CategoryName, Description FROM [Categories] ORDER BY CategoryID DESC">
 
Share this answer
 
v2
try aas:
ASP.NET
<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:ConnString %>" xmlns:asp="#unknown">
                        SelectCommand="SELECT [PhotoId], [PhotoTitle], [PhotoPath], [PostedDate],[UNC_PhotoPath], [Thumbs_Path] FROM [JFP_PHOTO_GALLERY] ORDER BY [PhotoId] DESC">


in web.congig add:

<add name="ConnString" providername="System.Data.SqlClient" connectionstring="server= xyz;database=xxx;User id=usr_id;Password=xxxxx" />
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900