Sir I want to connect sql server database as a public in asp.net C#
i'm connected sql server in Web.Config file but i don't know how to use as a public in full project help me sir
vipin.luhach
0
Newbie Poster
Recommended Answers
Jump to PostCreate a public class which contains the connection string and new connection creation in a single method.
use the public class method in full project any where.public class DBConnectionClass { public Sqlconnection GetConnection() { string ConnectionString=System.Configuration.ConfigurationMangare.Connectionstring["ConnectionStringNameinWeb.config"].tostring(); Sqlconnection Cn=new SqlConnection(ConnectionString); return Cn; } }
It may helps …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.