منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : wep application
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
اين يكتب ال connection code في web application باستخدام vb.net هل في صفحة ال aspx ام في موديول
كود :
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