darlo23288 0 Newbie Poster

Hi, i juz wanted to know how to write this following codings in app.config.

In ASP.Net in web.config:

<configuration>
          <appSettings>
                <add key = "stu" value = "database = Gred; trusted_connection = yes; server = (local)">
          </appSettings>
     </configuration>

N in codings part:

Imports System.Data.SqlConnection
Dim con As New SqlConnection (ConfigurationSetting.AppSettings("stu"))

Now how to do the same thing in VB.Net(app.Settings)

I tried app.config:

<configuration>
     <appSettings>
          <add key = "stu.ConnectionString" value = "datasource = Gred; initial catalog = Apps; Integrated Security = SSPI; packet size = 4096"/>
     </appSettings>
</configuration>

N in codings part:

Imports System.Data.SqlClient
Me.stu.ConnectionString = CType (System.Configuration.ConfigurationSettings.AppSettings.GetValues("stu.ConnectionString"))

ASP.Net is not a prob but how to do the same thing in vb.net. The above codes was taken in net but doesnt work. Help me please... n plz do xplain d codes 2...;)