|
Hi All
I've created a pretty basic update command that uses oledbparameters that runs successfully. However, it locks the entire database (ie: no one else can use the Access database while the query is running)
Also, if the database is open in MS Access, my query fails because the "file is already in use"
what can I do to stop this. Can I specify a level of locking to use - optimistic, pessimistic, etc
Thanks for any advice
Jason
|
|
|
|
|
Here is my problem i'm authenticating a user say me, that is currently logged on, if he's in the correct role(group). If so and i'm an admin (group = app_admin) then no restrictions are set otherwise i will set restrictions, this functionality works, i can get the current user with windowsidentity.getcurrent, and so on.
I have a logon/logoff in my mainmenu that shows up a login form, where i put in a different username, password, and domain (now = computername), but domain function is also an option i would like to put in my app. since i'm building it in n-tier.
When i validate the user info from the login form and there is a user with the given password in the domain, it should change the windows logon or better use the windows logon to verify if user exists, so i can use the authentication trough the roles(groups) to set the restrictions if say it's a user (app_user) and not an admin, and set the username in statusbar, and keep the restrictions until a new login is performed, and that user belongs to a different group. Also need to logoff the current user, and say put in the most restrictions (or logon the default user with his default restrictions, wathever is the most simple/usable.)
And this is where it goes wrong, i use the logonuser (advapi.32) and get an error 1385, when cheking the new user login.
When i use the setting from the already logged on user he gives me no error and everething works fine.
So how can i logoff the current user and logon the new user without logging off windows, or making a new windows identity with the new user and associate him with my app so he will know the user and his role, when i get his windows.identity.
I know there is an impersonate, but that is not what i want, i think, please help me, i have searched throug the web and didn't find anything that states my problem, only geting winid, login automaticly, logoff windows, and so on but nothing that can help me.
partial code:
<pre>Private Function ValidateLogin() As Boolean
Try
Dim blnSuccess As Boolean = False
Dim UserName, Domain, Password As String
Domain = Me.txtDomain.Text
UserName = Me.txtUser.Text
Password = Me.txtPassword.Text
Dim token As IntPtr
If LogonUser(UserName, _
Domain, _
Password, _
LogonType.LOGON32_LOGON_INTERACTIVE, _
LogonProvider.LOGON32_PROVIDER_DEFAULT, token) = True Then
Return True
Else
Throw New System.Exception("Logon Failed. Error: " & _
GetLastError())
End If
Catch ex As System.Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Loginfailure")
End Try
End Function </pre>
-- modified at 21:02 Sunday 30th April, 2006
|
|
|
|
|
What i need, and ive seen it in a running app., so it can be done. Is that the app. checks the first logged on user info for first settings, or maybe its starts standard with no user loged in for the app. or a default user, because with first start up you can't access any buttons, except for a logon button in the app. And when you logon you can access the program except for the controls that are under an admin group. Then you have to logon with an admin user and password. The user info is than set in a label like username, in the program i've seen it's used for communication with other programs where he recognises your user and role and does the same restriction based settings, but i don't need that, just working with one app., so the user is actualy saved somewhere or in a way logged on. But when you open the start menu, you are in windows still logged on as the default user, so your user that falls under a group that is set in users and groups, is used for the app, but not for the windows logon. The app uses its own logon and uses the groups that u put in users and groups, but i'cant see any user in the users menu, just a default user used to logon windows, It also uses Active Directory. When i first had to set my password i just had to use the windows logon to set my password then it could be used in the app. So i'm not sure how this functions.
|
|
|
|
|
Hi all
every month i have to parse out a bill that comes to my company
so i decided to write a program to do it for me
right now i can parse it out ( by feild) and add it to a sorted list
so it comes in
username 1 , charge
username 2, charge
username 13, charge
username 1, charge
username 1, charge
username 4, charge
(no order)
and i parse it out to:
username1 , total bill
username2, total bill
The problem is that now they want it sorted by department ( give a mouse a cookie)
so im playing around with a sorted list and a structure
so it comes in
and the sorted list looks like this
key........value
username , structure (.username, .department ,.total)
it does all the math fine but im having trouble searching and displaying the structure after i get it into the sortedlist
any ideas
|
|
|
|
|
Hi,
in the SortedList the keys are the one you are sorting after, so in this case you sort by username and not by department. You can also access the structures rather quick (binary search algorithm) via the username:
MyStructure structure = (MyStructure)sortedList["username1"];
You shouldn't use the SortedList in this case. You could just create a normal Array of your structures
(MyStructure[]) and sort it:
MyStructure[] structures = CalcStructures();
Array.Sort(structures, new MyStructComparator);
public class MyStructComparator : IComparer {
public int Compare(object obj1, object obj2) {
return ((MyStructure)obj1).Department.CompareTo(((MyStructure)obj2).Department);
}
}
Now you could also easiliy add as much properties as you like and sort them accordingly.
|
|
|
|
|
Pardon the newbie quesiton but isnt that c+ code?
|
|
|
|
|
My structure and my sorted list
Dim ipassinfo As New SortedList<br />
Public Structure user<br />
'Declare data members<br />
Public username As String<br />
Public department As String<br />
Public domestictotal As Decimal<br />
End Structure
Breaks up the line
adds it to my structure
adds the user name and the structure to the sorted list
fields = MyLine.Split(ControlChars.Tab) 'Or Convert.ToChar(Keys.Tab)<br />
<br />
<br />
'check to see if entrie already exists if not create it<br />
If ipassinfo(fields(2)) Is Nothing Then<br />
'loading the structure<br />
userinfo.username = fields(2)<br />
userinfo.department = "???"<br />
userinfo.domestictotal = fields(9)<br />
'adding the structure to the sortedlist under key username<br />
ipassinfo.Add((fields(2)), userinfo)<br />
Else<br />
' adds charges to total if allready exists<br />
userinfo.domestictotal = userinfo.domestictotal + fields(9)<br />
End If
|
|
|
|
|
Hi,
sorry about the C# code. Sometimes I just forget in which forum I am
I assume your code runs inside a loop over all entries.
After that (such that upassinfo is completely filled) place the following code:
Dim userarray As user()
ReDim userarray(ipassinfo.Values.Count)
ipassinfo.Values.CopyTo(userarray, 0)
userarray.Sort(userarray, New MyStructComparator)
Dim u As user
For Each u In userarray
'do something in sorted order
Next
Moreover you'll need this class:
Public Class MyStructComparator
Implements IComparer
Public Overridable Function Compare(ByVal x As Object,
ByVal y As Object) As Integer Implements IComparer.Compare
Return CType(x, user).department.CompareTo(CType(y, user).department)
End Function
End Class
|
|
|
|
|
Hi,
I have the following questions:
How can I write data in an Excel sheet and what is the proper object to display data in from an Excel sheet in a Windows form?
How can I insert input data from a form in an existing Microsoft Word document and how can I display the result?
Thank you.
-- modified at 2:05 Monday 1st May, 2006
|
|
|
|
|
hi ,
please i have a problem with date & time
as you know SQL Server have just a datetime type when i want to recuperate date from database in a textbox i got both the date&time in the same textbox ,but i want to get just the date or just the time
i hope you nderstood me
please if you did ell me how to do because i have a real problem with
thank you very much
try to be good if you can't be the best
|
|
|
|
|
VB or VB.NET?
Show the code that you have problems with, or noone can help you with it.
---
b { font-weight: normal; }
|
|
|
|
|
Mohammed Amine wrote: as you know SQL Server have just a datetime type
Actually it has a DATETIME and a SMALLDATETIME
Mohammed Amine wrote: i want to recuperate date from database in a textbox i got both the date&time in the same textbox ,but i want to get just the date or just the time
You can use DateTime.ToString()[^] to format the DateTime object.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
hi ,
please i added a picturebox to my application & it is behind all the controls of the form but i have labels on this picture & i wanna make this labels trensparent it was possible in vb.6 can you tell me how to do it in vb.net ??
thank you for your help
try to be good if you can't be the best
|
|
|
|
|
Set the BackColor property of Label to Transparent.
regards
Mubashir
|
|
|
|
|
thnx , but i don't think it will work because it is no transparent propriete in vb.net isn't it ??
may be i'm wrong i will seek for but i hoe to get an answear concerning vb.net i know this propriete exist in vb.6
thank you anyway for your help
try to be good if you can't be the best
|
|
|
|
|
Hi to all,
In IN WINDOW APPLICATION, I would like to know how can I print the page of the output window programically.
Thanks
Pankaj Garg
-- modified at 10:59 Sunday 30th April, 2006
|
|
|
|
|
|
Hi,
How I can copy any file to special directory >>
example:
file:- "red.avi" on the desktop.
directory:-" vedio" on the C.
How I can copy red.avi and put this copy in the C:\vedio
where become C:\vedio\red.avi
|
|
|
|
|
FileInfo class[^]. Look down the table, about the middle, on this page and you'll find a couple links to examples.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
tank you very very much >>
|
|
|
|
|
I am a complete newbie to programming and I need to work out how to use an on-screen keypad to enter values into a text-box. I'm not sure how to get the numbers to appear without erasing previously entered numbers. I know this is very basic but can anybody help?
|
|
|
|
|
Let's see the code your using. If your replacing everything in a TextBox when you hit a button, you're probably not assigning its Text property correctly.
I'd put this at an intermediate level task. On the surface, it looks really easy, but you have to have more than just a passing knowledge of how focus and selection works and how to track it properly.
If this input method was to be used in multiple places, it would be better written as it's own control.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi
I have form1 as MDI parent and i displayed the form2 as MDI child of form1 then i want to open form3 as MDI child of form1 from form2.
Please give me the solution.
Thnaks in advance.
MAP Tiger
Tiger Softwares
Software Designer and Developer
VB.NET, ASP.NET, VFP
|
|
|
|
|
This is not a good idea. The parent form should open all of it's child forms. Child forms should not be opening sibling child forms.
It can be done, but makes for spaghetti code:
Dim myForm As New Form3
myForm.MdiParent = Me.MdiParent
myForm.Show()
Dave Kreskowiak
Microsoft MVP - Visual Basic
-- modified at 11:06 Sunday 30th April, 2006
|
|
|
|
|
Well, thanks for this help n i got one more solution for that:
Dim myForm As New Form3
myForm.MdiParent = Me.ParentForm
myForm.Show()
MAP Tiger
Tiger Softwares
Software Designer and Developer
VB.NET, ASP.NET, VFP
|
|
|
|
|