Sql Server Connection String for VB.net

  • 13 years ago

    hi ,

     

    can anybody help me out,pls !!!

    i need SQL Server Connection String for VB.net

    sekkeena

  • 13 years ago

    Hi Sekkeena
    in web.config

    <connectionStrings>
      <remove name="Connect"/>
      <add name="connect" connectionString="server=AlohaMora; database=dbAloha; uid=sa; pwd=aloha;"/>
     </connectionStrings>
    Now u can use it in your webpages as

    Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("connect").ConnectionString)
    and when u need the connection just type





    conn.open

    <do needfull >

    conn.close

    Hope it helps
    Aloha

  • 13 years ago

    hi,

    thanx

    actually i not making a web application.this is a desktop application, so how can i use it.

    sekkeena

  • 13 years ago

    Hi

    it is simple.Just use this as  connection string by providing ur server name,database name along with its user id and pwd.

    dim con as new sqlconnection("server=servername;user id=u;password=pwd;;Database=DBase")

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“An idiot with a computer is a faster, better idiot” - Rich Julius