|
He vants to bite your knowledge. Blahhhh!!!!![^]
This space for rent
|
|
|
|
|
|
He has been told on many occasions, but is just too lazy to do it.
|
|
|
|
|
|
thanks a lot for your link
tbhattacharjee
|
|
|
|
|
Hi All,
I have a windows form application (C#) and the users can login to the application by user name and password, and I need to prevent the same user to login to the system from different machines or only one time login, and if the user is logged in I need to disallow a login with a notification the user is already logged in.
C# Desktop Application Not Web With MS SQL Server Database
Thank you
|
|
|
|
|
One way to do this is to query if there already is a session for that specific user in the system. You can get the information from sys.dm_exec_sessions[^]
Since not every user is allowed to query that view, it's best if you do the check inside a stored procedure upon connecting to the database. If the connection is already found (or actually if there now is two connections) then raise an error from the procedure to inform client application that new connection isn't allowed. Another option is to use Logon Triggers[^]
Depending on the requirements, you can check if the host is different if you need to allow multiple connections from the same host
modified 18-Sep-16 10:31am.
|
|
|
|
|
Hi,
dm_exec_sessions is about sql user authentication, but I need for my application users
In my application database I have a users table with login name and Password
I need to check if the User is open the application and logged in I want prevent it login again
from the same PC or from different PC's
Thanks
|
|
|
|
|
First of all, dm_exec_sessions contains rows for both SQL Server authenticated users and Windows authenticated users. So regardless of the authentication method, a row exists if a connection exists.
What comes to user identification, do you have information about the actual OS user in your user table?
If you do, you could use that info from nt_user_name column and check if that user matches.
|
|
|
|
|
Sorry for coming back so late, but if you still have open questions concerning this, have a look at Restricting logon to SQL Server[^] . Perhaps there would be some usable ideas for you.
|
|
|
|
|
i have TSC TTP-244 Bar code Printer, i am making an application in asp.net to Generate Bar code. Generated Bar Code showing in crystal report. when i am using print command then print label but after one label print, position of text on label shift on top on every time when give print command.
please help me to set print label proper way using this printer.
|
|
|
|
|
The printer settings probably do not match the "label size".
This has nothing to do with C#.
|
|
|
|
|
Member 11166318 wrote: in asp.net
Bear in mind that if you're printing from C#, that happens on the server. If you're expecting the label to appear on the user's printer, then you're going to be disappointed.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Is there an easy way to bind a combobox to populate with the names of the tables in a given dataset? When I search all I am finding are questions and examples of binding to a datatable, not the names of the tables in a dataset.
I was hoping for something similar to when debugging in Visual Studio and you have a watch on a dataset. When you examine the value, you get a dropdown with the table names, and switching will show you the data table in a datagrid view.
I currently clear the items from the combobox, and iterate through the table names adding them to the combobox. When the combobox changes I then set my datamember of my grid view to be dataset[combobox1.SelectedItem.ToString], which works but feels clunky.
My application will be using different typed datasets so I need to be able to change the combobox when the dataset changes.
|
|
|
|
|
You wanted an "easy way"; not sure if this qualifies:
foreach( DataTable table in _ds.Tables ) {
this.comboBox1.Items.Add( table.TableName );
}
|
|
|
|
|
hi all,
i have an windows form with some TextBox and a Picutre box.
i want to draw its value in a image in a report format.
how can i do this.
how can i decide the size of image.
how can i draw line by line with all textbox values.
please help me for this.
thanks in advance.
|
|
|
|
|
You need to explain in rather more detail what you are trying to do - drawing onto an Image is pretty trivial, all you have to do is get a Graphics context for the image and call the appropriate methods from the class: Graphics Class (System.Drawing)[^]
There is background here: Drawing Text and Graphics[^] - it all talks about a Form, but the principles and even the methdos are the same once you get the Graphics object for your Image.
But we don't know exactly what part of this is giving you problems - remember that we can't see your screen, access your HDD, or read your mind: we only get exactly what you type to work from. So you need to explain in enough detail that we can "fill in the gaps" without having the context from your project!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Rectangle rect_ctrl = panel_controls.Bounds;
image_rect = new Rectangle(0, 0, rect_ctrl.Width, rect_ctrl.Height);
drawing_point = new Point(50, 0);
str_rect = new Rectangle(0, drawing_point.Y, image_rect.Width, drawing_point.Y + 50);
int color = Screen.PrimaryScreen.BitsPerPixel;
PixelFormat pf;
pf = PixelFormat.Format32bppArgb;
Bitmap BM = new Bitmap(image_rect.Width, image_rect.Height, pf);
Graphics g = Graphics.FromImage(BM);
g.DrawImage(Photo_LB.Image, rect_pic);
and
draw string for all text control
than
g.Dispose();
ImageFormat My_Image_Format = ImageFormat.Jpeg;
BM.Save(Application.StartupPath+"\\test.jpg");
here i set size of image as panel size, but if text is more in text box full text not visible in image how can i sent image size for this.
|
|
|
|
|
Well - without seeing your DrawString calls, it's not possible to be accurate, but...
If your problem is that text is not fitting then there are only two things you can do:
1) Use the bounding rectangle to allow the text to use more than one line - you are probably doing this already.
2) If multiline text just doesn't fit, then you need to reduce the font size to fit your text in there. That's complicated, because there isn't a "fit text to rectangle"function in .NET. What you will have to do is use Graphics.MeasureString to work out how much space the string needs at a particular size, and resize the font to fit. MSDN does have a basic example: Dynamic Graphic Text Resizing[^] but you will probably need to work on it quite a bit to get exactly what you are looking for.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
g.DrawString(value, heading_font, C_Brush, str_rect, SF_TEXT);
|
|
|
|
|
So you have a small area to hold the string: 50 pixels high is about enough for two lines at a "normal" font size, but "heading_font" implies it's bigger than that, so at a guess one line.
Use MeasureString to check your string dimensions and consider looking at the MSDN method to see if you can "squash" the font down enough to fit it in.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
You're welcome!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
g.DrawString(value, heading_font, C_Brush, str_rect, SF_TEXT);
|
|
|
|
|
I'm sorry but your post doesn't make much sense. There are too many areas that we could be making assumptions about here. Are you saying that you want to take a screenshot of the form and put it in a report? Is it a case that you want to post the values from the text boxes and the image and put them line by line in a report? Are you using report writing software? What exactly do you mean by a report? Are you including headers and footers? Do you expect this to be multipage? Are the number of text boxes and images fixed? Where do the images come from? Are they cropped/resized, or are the images scrollable?
This space for rent
|
|
|
|