You can write it Webconfig, Class , Module, xx.vb, or in page markup,
But we have not Modules exist in Asp.ney items we need to create it
in webconfig your connection string will be like this
<connectionStrings>
<add name="MyConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=database;Integrated Security=True"
</connectionStrings>
*Add class
rename it module1
inside code change " Class1 to module1"
now ready to use
Public Module Module1
End Module
* in xx.vb
SqlDataSource1.ConnectionString = "Data Source=.\SQLEXPRESS;Initial Catalog=database;Integrated Security=True"
*Markup we need type
<Script>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
here our connection string like this
SqlDataSource1.ConnectionString = "Data Source=.\SQLEXPRESS;Initial Catalog=database;Integrated Security=True"
end sub
</Script>
Best wishes
سبحان الله والحمدللهولا إله إلا الله والله أكبر
اللهم اغْفِرْ لِلمؤمنين والمؤمنات والمسلمين والمسلمات الأحياء منهم والأموات