Instantiate Multiple Sql Connections To The Same Database Via Threading Without Getting An Error?

Apr 8, 2011

I'm running a program where I call a function which creates a database connection and then runs a stored procedure. I call this function four times from four separate threads. I get an error (Login failed for user 'sa'. The user is not associated with a trusted SQL Server connection.

Exception Source:
.Net SqlClient Data Provider)
when I use multiple threads, but if I have the threads run one after another I have no

[code].....

View 1 Replies


ADVERTISEMENT

Sql - Multiple Database Connections Within 1 Application - .NET?

Mar 16, 2012

This may have been answered but my search hasn't found what I was looking for. Basically, I am developing an application which allows the user to build a query at design time, i.e. for users with no prerequisite knowledge of SQL The application thus far allows the user to select which table(s) from the database they wish to start querying (I won't go into the details of the rest for now)

My confusion is this; I already have the connection to the database in a subroutine which obtains the schema information and filters it to display only the available tables within the database, which then compiles the data into a listbox, here is that sub:

[Code]...

View 1 Replies

Threading And Db Connections In Vb?

Feb 23, 2011

I'm trying to understand how to handle db connections in a multi-theaded windows program.It I have this simple class:

public class MyClass
private myConn as new sqlconnection
private MyThreadPool(5) as Thread

[code]....

View 10 Replies

Threading And Socket Connections Approach

Jul 2, 2011

Im writing a small application that need to make up to 300 socket connections at the same time. However i'm pretty confused on how to approach this. My first theory is to have my main thread to manually fire up 300 new threads that each handle all that needs to be done. Another theory is to fire up lets say 10 threads that makes 30 async connections. My last theory is to have my mainthread work with all 300 async connections together with everything else. The question to this is what would be the most effective way to go to save resources and maintain speed.

View 1 Replies

Can't Simultaneously Instantiate Multiple Forms?

May 5, 2010

I used different backgroundworkers to instantiate some 'heavy' forms thinking that it will reduce the time to instantiate them if I did them at once but it looks like I am wrong since it is still taking about 43 seconds to load all of them. Am I missing something or do you have a tip on how I can speed up their instantiation?

View 15 Replies

Multiple Socket Connections?

Nov 14, 2010

OK here is some code I nicked from web and I have changed some things, it works but only accepting one client, how do I make this accept multiple clients?

[Code]...

View 2 Replies

Unable To Instantiate Database Object

Jan 24, 2010

I have an application which I am trying out on machines without mysql. The app runs fine on my local host however when I try to use the application on another machine I am getting the following error:

Access denied for user 'root'@'localhost (using password: YES)

Then I get a .net framework error

System.NullReferenceException: Object reference not set to an instance of an object.

I thought I had exported the DB but I was left with a mysql file which I placed in the bin directory.

View 2 Replies

.NET - DataGridView - Multiple Connections And Queries?

Oct 8, 2010

I am new(ish) to Visual Basic and i have learned from looking at old VB6 code for programs that have been made for us in the past, this includes using the old ADODB connections and FlexGrids which both have been changed in VB.Net to OLEDB and DataGridView.I have started to understand the way the connections and datasets etc are created but i am struggling to get to where i was with the old code (I am trying to completely upgrade the code from FlexGrid).This is the VB6 Code i am trying to upgrade from:

[Code]...

View 14 Replies

Multiple Socket Connections Per Thread?

Sep 8, 2011

We are using VB.NET 2010. Our application receives client connection through socket, and currently each client has its own thread and socket. We would like to have multiple socket connections per thread, but we are having a problem doing it.

Below is our current program where each client has itsown tread and socket.
Public class frmMyForm:
Private Sub AcceptSocket(ByVal Sock As SocketTools.SocketWrench)
Try
Dim oSession As SessionClass
Dim oThread As Threading.Thread
[Code] .....

View 1 Replies

C# - Disable Multiple Network Connections, Only Allow One Simultaneously?

Feb 17, 2011

We are looking to design a security application that does the following on laptops:If the ethernet adapter is used (cable plugged in) disable/block all other network connections (wireless WIFI, mobile broadband (PPP), virtual VPN adapters etc)When ethernet adapter is not being used again, all connections allowed.We have looked in the WMI a lot but there are no good ways of doing this. Only disabling the network connection is not secure enough because most mobile broadband applications try to re-establish the connection. This should be an application that works on all laptop vendors without any user interaction (such as choosing interfaces etc..).

View 3 Replies

Multiple Socket Connections - Address Of Parameters?

Mar 2, 2012

I am writing a socket client into my application. I have multiple socket connections to make to different servers.
ClientSocket(1).BeginConnect(endpoint1, AddressOf Connected, Nothing)
ClientSocket(2).BeginConnect(endpoint2, AddressOf Connected, Nothing)
Both clients call the connected sub... how do I know which one is which?
Private Sub Connected(ByVal ar As IAsyncResult)

View 3 Replies

VS 2010 : Multiple Connections To Single Webcam?

Nov 11, 2011

I have written a program that uses directshowlib to capture a stream from a webcam and save as an AVI whenever a bird lands on the experiment platform for behavioral research. What I would like is to be able to allow another program or connection to the same webcam at the same time simply for preview purposes, is this possible?

Basically I want my app to still be able to record on demand when a bird interacts but I would also like a IP cam program like webcamXP/Webcam7 to be able to stream a live feed to the internet so we can have a live view of the platform. I had found some articles about connecting multiple streams from one webcam but am not sure how to go about it. If I have to I will simply mount a 2nd cam in the Bird colony and dedicate it to the web stream but if I can use the same cam as the recording cam that would be great.

View 2 Replies

Cyberproj - Connections From Multiple Clients To A Server Having Winsock Control

May 17, 2010

I am developing project on cyber cafe using vb .net 2005 and winsock i don't know how to accept connections from multiple clients to a server having winsock control

View 2 Replies

.Net SQLClient Connections And SQL Server - Active Connections Reflect Even Though All Closed?

Jul 19, 2011

Using VB.Net and SQL Server 2008 R2: I have recently had a database that using sp_who2 reflects a connection ".Net SqlClient Data Provider" is still active even though the .Net application has closed and disposed of all connections.

[Code]...

View 1 Replies

Multiple Forms - Declare And Instantiate Second Form On Program Start - Use Button Simply To Show Form?

Jan 14, 2010

I have a program that uses two forms. The program opens to the Main form, and the user can navigate to the other form from the Main form through use of a button. Here's the way I've currently written it: When the Main form loads, it declares and instantiates the other form during the load procedure. When the user presses a button, the second form is displayed by means of the ShowDialog method. On the second form, there is a Return to Main Screen button which closes the second form, bringing the user back to the Main form.

So, here's the structure of the code:

Code:
Public Class frmMainForm

Dim frmSecondForm As New SecondForm

Private Sub btnSecondForm_Click(blah, blah, blah) Handles blah, blah, blah

[CODE]...

Here's my reasoning: Originally, I wrote the code so that a new instance of the second form was created every time the button was pressed. The problem was that whatever data was displayed on the second form, previously, was lost when the user returned to it a second time. Since the user would be switching back and forth between these forms, frequently, I needed that data to persist.

What is the best practice for accomplishing this:

1) Declare and instantiate the second form on program start, as I have done, and use the button simply to show the form?

2) Declare and instantiate the second form each time the button is pressed but maintain the variables on the Main form and pass them ByRef to a custom constructor for the second form? Is this even possible?

3) Something else?

View 5 Replies

Multi-Threading On Multiple CPU

Aug 20, 2009

One of our products consists of two different services:

- main service that launched at the startup of Wndows
- GUI that launched manualy when needed

GUI is representing data from main service.Main service starts X amount of threads that do some work and gether data.Some minor data and adresses to threads are stored in chache memory, so that GUI will have access to them.Everything works fine in 99% cases, but in some rare cases GUI do not display any data when used on machines with multiple processors (not milti-core). My guess is that it can't access the memory -> probably OS "decided" to run main service on one processor and GUI on another one.Is there any way to access the memory alocated for one processor from the service that runs on another processor?Or is there simple and secure way (same application will be also runing on single processor machines) to specify both services to run on the same processor?

View 4 Replies

Background Worker And Multiple Threading

Apr 27, 2010

I have created a background worker to go and run a pretty long task that includes creating more threads which will read from a file of urls and crawl each. I tried following it through debugging and found that the background process ends prematurely for no apparent reason. Is there something wrong in the logic of my code that is causing this. [code]Also my main thread runs a forms from where this background is called to run but the main thread is supposed to wait for the background process to end unless the user selects another option from the main form.

View 3 Replies

When Using Multi Threading - Use Multiple Browsers?

May 3, 2011

I came across this app yesterday which looked strange to me as it had about 20 web browsers popped up and running all 20 processes seperatly.

View 2 Replies

Classes And Connections To The Database?

Jul 28, 2009

i've been previously using Visual Studios built in wizards for manipulating data access to and from an MSAccess Database, however just recently i coded my own classes and connections to the database, ive been able to select, update and delete records effectively however my problem comes with inserting records.

I have a 3 tiered table database:Tbl_PO, Tbl_Parts, Tbl_Shipments each po has multiple parts, each part has multiple shipments.when i insert a record into the tbl_PO, i need to retrieve the ID used on that insertion.

View 4 Replies

Remoting - Threading Or Running Multiple Servers

Aug 20, 2009

after my last post i dove into remoting to try to solve my performance problem in a client-server fashion.
This works very well, but i come across a big problem which i don't seem to get solved.

I made a well known singleton servicetype on the server that retrieve all customers. Whith 1 db connection this works fine. But very often customers and i use in 1 sql instance multiple databases (for each administration a separate db). so the whole purpose of a singleton object is hereby destroys as soon i connect in my class to a different db. Is there some way to overcome this for example threading or running multiple servers (for each db it's own server-application)?

View 13 Replies

Threading: Multiple Looping Threads Where They're Guaranteed To Run?

Jul 12, 2011

When the program starts, it checks for the amount of threads the user wants to use to download files with. The threads are then created. When the user chooses a file to download, the threads begin grabbing the file until it's fully downloaded.The problem is, some threads stall right from the start, & just sit there doing nothing.The global work variable is Sync-Locked, then quickly released by each instance, & to my eyes, there is nothing wrong.They are all instances of the same class, & do the exact same thing, so why is it that some run, & others don't?VB.NET is the programming language. They are looping Background workers.I would really like to know why some run, & others don't.btw... they have quick non-blocking sleeps, as well as blocking sleeps to allow others the chance to run (proprietary non-blocking DLL).So all i'm left to think on is that Microsoft's process queuing has some type of bug going on in there someplace....or is there a way to do multiple looping threads where they're guaranteed to run?

View 2 Replies

Database Connections And Combo Boxes?

Aug 19, 2009

I'm doing an application which uses the Database Wizard to link the textboxes, labels, and combo boxes to the data base. (Visual Basic in Visual Studio 2008). (Visual Basic 2008 by Shelly Cashman-Chapter 10)There are two problems: One of the combo boxes has the unique key identifier. You are supposed to be able to use the combo box arrow to select one of the unique keys. Every time I click on one of the unique keys to see the records connected to it, VB acts like I'm trying to input a duplicate key. My teacher hasn't been able to figure this one either. If I was connecting the code, I could fix this but I have no clue since I have to use the Database Wizard on how to fix it.

View 4 Replies

Save Database Connections In Xml File

Mar 8, 2011

I am on a general scenario of deploying my vb.net database application on my client's computer.

Thinking of future problem of changing the database connection setting, i am planning to store it in a normal xml file in the app directory so that where ever it is installed, in order to make database configuration i only need to make change to that file and my program runs smoothly.

So is this idea of storing database connection setting to xml config file in app directory or is there any other better idea?

I am planning it for vb.net winforms applications

View 1 Replies

IDE :: Does Microsoft Query Support Multi-database Connections

Mar 25, 2010

I have an multi-database ODBC connection through a DSN. There is a primary database and two auxiliary catalogs. The Add Tables dialog in Microsoft Query only shows the tables in the primary database. If I pick one and continue on, the lists of columns in other parts of MS Query show all the columns in both the primary and auxiliary databases. If I pick a column, MS Query will look for that column in the primary database (great if it happens to be there, not so great if it doesn't). If I don't use any of the drop-down lists and just write a query in the freeform SQL editor, fully qualifying everything with the catalog names, the query runs fine.It looks as though MS Query is assuming only one database and one (default) catalog, and doesn't realize that it actually connected to several databases with separate catalogs.I get the same results with Office 2003 and Office 2007.Are multiple databases / multiple catalogs through a single DSN supported in Excel / Microsoft Query?

View 1 Replies

C# - Optimal Database Connection String For High Traffic Connections?

Mar 14, 2011

I just want to know, What parameters or attributes should be taken in connection string so as to handle high traffic enterprise applications? Like in general we use server, initial catalog, userid, passwd. Some times we add timeout , and in some scenario pool etc. But i don't know what attributes should i take in as my common practice apart from above.

View 3 Replies

Close All Connections To Access Db In Order To Back Up The Database File?

Nov 11, 2010

I have an application running with a access db. I have written some code to copy & zip the db file to another location (selected by the user) for the purpose of backup. (I am using sharpzipwrapper)Whenever I try to run the code for the copying & zipping it gives me an exception saying that the file cannot be zipped as it is use.Do I have to close all open connections in order to backup the .accdb file? If yes then how? else what do i have to do inorder to get 'access' to the file.Do I have to exit the application to close all connections? These connections are written in code for e.g. :

dim
cnStudent as
oledbconnection

[code].....

View 5 Replies

Reading Forum Input - Opening Database Connections And Calling VB Code

Jul 31, 2011

I am extremly new to this concept of aps.net and vb. all the tutorials I see are c# based or very basic for vb. What I have is a contact forum with some basic information. I got the whole "check if the user has input information correctly down pat how ever Its this whole, connecting to a database (sdf) if in another vb file ands calling that method into aspx file and proessing forum input to say "take this, insert into bla..." I come from java, JSP and J2ee bak ground where its not that diffrent and I dont have all week to read books and take baby steps. I have until tuseday morning to finsih this. Right now I am as far as forum validation....

[Code]...

View 1 Replies

Threading Error - Cannot Use RichTextBox

Apr 1, 2010

I need to ping to a port. It is working, then I tried multi threading. I need to show the result in richtext box, but it shows error.

The code is
Imports
System.Threading
Public
Class Form1
Dim t As Thread = New Thread(AddressOf Me.ProcessBioAdmin)
[Code] .....

Error got is:
Cross-thread operation not valid: Control 'RichTextBox1' accessed from a thread other than the thread it was created on.

View 2 Replies

Asp.net - Database Connections Work Fine When Application Is Run From Localhost. Login Fails From Dev Server

Jun 11, 2009

I have an application which connects to a database, retrieves a username from a user's table and matches it against the username retrieved with System.Security.Principal.WindowsIdentity.GetCurrent.Name.On my localhost, everything works fine. The database exists on the development server but the application lies on my localhost. All of my authorization and authentication techniques are running smoothly.However, when I publish my application to the development server, I'm faced with the following error.Cannot open database requested in login 'databaseName'. Login fails.Login failed for user 'DevelopmentServerNameASPNET'.

[Code]...

View 4 Replies

Threading Error On Form Close

Aug 15, 2011

I'm upgrading some code from VB2003 to VB2010. I'm now getting an error when I try to close a form from a media player event.

[Code]...

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved