single connection
-
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 -
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 Tahercould you provide how you create the (public_connection) ??
When you get mad...THINK twice that the only advice Tamimi - Code
-
could you provide how you create the (public_connection) ??
When you get mad...THINK twice that the only advice Tamimi - Code
Public connect As New OleDbConnection() connect.ConnectionString="connection String" this i have created in the module
-
Public connect As New OleDbConnection() connect.ConnectionString="connection String" this i have created in the module
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
-
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
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 formPublic 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 -
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 formPublic 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 TaherDear, 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
-
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 TaherTIP: 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