Question

I am a bit new to this VB.NET application stuff. I currently try to develop a application using Microsoft Visual Basic. Net with Remote SQL Server 2005. In my application include user login using Username and Password. The application will use from many branches. Every branch have their own Username and Password. I create User Master table in SQL Server Database with SLN, User_name, Password, Branch, Note fields.

Now I want to design a VB.Net Form in my application where I can get all Username and Branch login status in a DataGridView like....

Header - *Branch Username Status* Value - Kolkata U00001 Logged

How can I get this? If any senior vb.net developer or expert solve the same i will be very thanks full to him. Thanking you.

Was it helpful?

Solution

Here is some SQL to extract the current users:

select distinct DB_NAME(dbid),loginame, dbid 
FROM sys.sysprocesses
where [dbid] not in(0,1,4) -- exclude list

Note there are two levels of security in SQL Server - SQL Security and "Integrated" security. The latter uses the windows login, SQL Security is managed by you within SQL Server. It looks like you intend to add an SQL user/login named for the branch with a defined password that everyone in the branch will use. Not a great idea IMO. You can use integrated security and add each windows user to SQL server and then add the SQL users to security groups to control access to the SQL objects. This would require each user to authenticate with your windows servers first locally before they can connect to the remote server.

I'd highly recommend you upgrade to at least SQL Server 2008 R2.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top