Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. single connection

single connection

Scheduled Pinned Locked Moved Visual Basic
help
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    taherjaorawala
    wrote on last edited by
    #1

    dear friends I have 6 to 7 windows froms and all the forms have their connection string. I want that all the form should use single connection. so i created a public connection but when i assign the connection to the in the automatically generated code Me.OleDbDeleteCommand3.Connection = public_connection it shows an error what should i do to solve the error please help Taher

    T C 2 Replies Last reply
    0
    • T taherjaorawala

      dear friends I have 6 to 7 windows froms and all the forms have their connection string. I want that all the form should use single connection. so i created a public connection but when i assign the connection to the in the automatically generated code Me.OleDbDeleteCommand3.Connection = public_connection it shows an error what should i do to solve the error please help Taher

      T Offline
      T Offline
      Tamimi Code
      wrote on last edited by
      #2

      could you provide how you create the (public_connection) ??

      When you get mad...THINK twice that the only advice Tamimi - Code

      T 1 Reply Last reply
      0
      • T Tamimi Code

        could you provide how you create the (public_connection) ??

        When you get mad...THINK twice that the only advice Tamimi - Code

        T Offline
        T Offline
        taherjaorawala
        wrote on last edited by
        #3

        Public connect As New OleDbConnection() connect.ConnectionString="connection String" this i have created in the module

        T 1 Reply Last reply
        0
        • T taherjaorawala

          Public connect As New OleDbConnection() connect.ConnectionString="connection String" this i have created in the module

          T Offline
          T Offline
          Tamimi Code
          wrote on last edited by
          #4

          did you call the method that call the above code in the module!! then are you sure that your connection String is valid one ??

          When you get mad...THINK twice that the only advice Tamimi - Code

          T 1 Reply Last reply
          0
          • T Tamimi Code

            did you call the method that call the above code in the module!! then are you sure that your connection String is valid one ??

            When you get mad...THINK twice that the only advice Tamimi - Code

            T Offline
            T Offline
            taherjaorawala
            wrote on last edited by
            #5

            In the module Public connect As New OleDbConnection Public Sub connection_string() connect.Connectionstring="Provider=SQLOLEDB.1;Password=xyz;User ID=sa;Initial Catalog=inventory;Auto Translate=True;Packet Size=4096;Use Encryption for Data=False;Tag with column collation when possible=False" End Sub then on the startup form Public Sub New() MyBase.New() connection_string() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub this way the string is assigned to the connection Taher

            N 1 Reply Last reply
            0
            • T taherjaorawala

              In the module Public connect As New OleDbConnection Public Sub connection_string() connect.Connectionstring="Provider=SQLOLEDB.1;Password=xyz;User ID=sa;Initial Catalog=inventory;Auto Translate=True;Packet Size=4096;Use Encryption for Data=False;Tag with column collation when possible=False" End Sub then on the startup form Public Sub New() MyBase.New() connection_string() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub this way the string is assigned to the connection Taher

              N Offline
              N Offline
              Navneet Hegde
              wrote on last edited by
              #6

              Dear, Its better to create a common connection class with Connection defined along with Dateset , Adapter, So that its better managed . Thuogh i didn't understood your connection and forms layout and requirement I thing to remenber In .NET that ADO.NET uses Dissconnected Architecture. Hope to help,Though this may not be exact , but you can getback to me for any help related Regard, Navneet Hegde navneethegde@yahoo.co.in navneethegde@gmail.com navneet.hegde@procit.com Thanks,

              Develop2Program & Program2Develop

              1 Reply Last reply
              0
              • T taherjaorawala

                dear friends I have 6 to 7 windows froms and all the forms have their connection string. I want that all the form should use single connection. so i created a public connection but when i assign the connection to the in the automatically generated code Me.OleDbDeleteCommand3.Connection = public_connection it shows an error what should i do to solve the error please help Taher

                C Offline
                C Offline
                Colin Angus Mackay
                wrote on last edited by
                #7

                TIP: Share the connection STRING, but not the connection object. The connection will be pooled so opening and closing a connection has no performance impact. When running a query the following is generally regarded as best practice: Aquire connection, perform query, release connection. Keeping the bit between aquiring the connection and releasing it again as short as possible.


                Upcoming events: * Glasgow Geek Dinner (5th March) * Glasgow: Tell us what you want to see in 2007 My: Website | Blog | Photos

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups