|
when i load the report a pop up window appears asking for the sa password
is there any way to avoid that
|
|
|
|
|
this is happening on the same machine or other
i think just specify proper userid,pwd,server
while login to report
|
|
|
|
|
I have a Winform with some textboxes and comboboxes to search values from sqlserver,
i need to recognize when my fields are empty and users dont input anything and by mean they dont need fields,and i have to know they dont want a field or this field is a null
i am looking for the best way to handle null values in textboxes and comboboxes in c#
thanks
|
|
|
|
|
I think, there are no null in textbox/combobox.
I check it using :
if(textBox.Text.Trim().Length == 0)
{
MessageBox.Show("TextBox is empty");
}
if(comboBox.Text.Trim().Length == 0)
{
MessageBox.Show("ComboBox is empty");
}
|
|
|
|
|
i want to know how to recognize null values or not required fileds when fileds are empty
for example: u have 2 textboxes name and id ,one time u want to select DB all of members that they have no id (it means in search fields id is null field----select name, id from t1 where id = null) another time u need to select members that their id is blank----(select name from t1 where id = '';)
thanks again
|
|
|
|
|
Yes, and stancrm gave you the answer. Just replace the MessageBox with your own logic.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
What about:
if (String.IsNullOrEmpty(textBox.Text))
{
MessageBox.Show("TextBox is empty");
}
etc.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Saeed.394 wrote: the best way to handle null values in textboxes and comboboxes in c#
It's a trivial but very important question. I can give you some references which might help you decide upon the 'best'(as I donot even know the best way ) way.
1. First take a look how you are going to handle null values in ADO.NET[^]
2. Noe it's time to create some controls which can handle null values[^]
3. One more vey important control which you may need is Nullable Datetime picker[^]. I even used in many places.You might need to tweak the code per your requirement.
Let me know if this helps you.
|
|
|
|
|
You will probably need another control for user to signify they want a null value, ie
ID |Text Box| X Search for Null ID
if user enter into text box, ignore checkbox and search for ID = 'whatevertheuserenter'. If user checked the checkbox, search for ID Is Null.
|
|
|
|
|
I was reading on using the WIA to access cameras and ran across the WPD api.
I'm having a little trouble from where to start to use this. I know that it works with XP+ and I have also downloaded the Windows SDK. Do you know of any tutorials on this API?
I know you are suppose to use
PortableDeviceApi 1.0 Type Library
PortableDeviceTypes 1.0 Type Library
Any articles or anything for C# on this would be nice..
Thanks in advance
|
|
|
|
|
Hello
I have created a library for accessing WPD device from Managed code.
At the moment, alone functions of reading are implemented but that a good start point.
Library is hosted on codeplex : http://www.codeplex.com/portabledevicelib/[^]
|
|
|
|
|
Great! I'll check it out and give you some feedback. Thanks!
Oh and is this kind of replacing WIA?
|
|
|
|
|
Hi:
Recently, I uses the WPD APIs to implement application, but I encounter a problem.
When I use PortableDeviceManagerClass.GetDevices to enumerate the devices,
my application always stops working. My application references the sample of
http://blogs.msdn.com/dimeby8/archive/2006/12/05/enumerating-wpd-devices-in-c.aspx[^].So, I want to referece your project, but the codes in codeplex can not be downloaded anymore, can you give me a hand, please?
20090917 updated.
I found out the root cause and solve the issue. In example of dimeby8, the modification of interop of GetDevices needs some change.
GetDevices([in][out] string[] marshal([]) pPnPDeviceIDs ← the modification of dimeby8
GetDevices([in][out] string[] marshal(lpwstr[]) pPnPDeviceIDs ← I modify
I have test it in x86 and x64 system. It can work.
modified on Thursday, September 17, 2009 10:37 PM
|
|
|
|
|
Any final solution with full source code sample application ?
IMHO, better samples for minimize learning curve are real applications with full source code and good patterns.
The one line of Power-shell script below un-mounts a USB cable attached Windows Portable Device (WPD) from the Windows Operating System (XP thru W8/2012)
And just in case you have not yet started playing with Powershell, here is the equivalent VBScript (maybe be can port to C#):
Set objWMIService = GetObject ("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery ("Select * from Win32ext_WPD Where strFriendlyName = 'SAMSUNG-SGH-I747'")
For Each objItem in colItems
Set objWMIWPDStatic = objWMIService.Get("Win32ext_WPD")
Set objInParam = objWMIWPDStatic.Methods_("EjectDevice").inParameters.SpawnInstance_()
objInParam.Properties_.Item("strObjectDeviceId") = objItem.strId
Set objOutParams = objWMIService.ExecMethod("Win32ext_WPD", "EjectDevice", objInParam)
Exit For
Next
Note change ‘SAMSUNG-SGH-I747′ to the phone/tablet name you see in Windows Explorer
About Win32ext_WPD
"Select * from Win32ext_WPD Where strFriendlyName = 'SAMSUNG-SGH-I747'"
Not well document googleing, not found more 2 references.
Maybe port to C# using:
var oScope = new ManagementScope(@"\\" + MachineName + @"\root\cimv2");
Reference:
http://squadratechnologies.wordpress.com/2013/07/24/windows-powershellvbscript-to-un-mount-a-smart-phone-or-tablet/
kiquenet.com
modified 26-Aug-14 4:56am.
|
|
|
|
|
I have this bit of code:
short s1 = 10;
short s2 = 5;
short s3 = s1 - s2;
Error says: Error Cannot implicitly convert type 'int' to 'short'. An explicit conversion exists (are you missing a cast?)
Aren't shorts just 16 bit integers? You can't subtract two of them?
*****************
"We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW
modified on Sunday, August 30, 2009 9:45 PM
|
|
|
|
|
int was assumed on the right side of the assignment.
MSDN
|
|
|
|
|
For some reason the designers of C# decided that 8- and 16-bit operations should return a 32-bit result rather than the expected data type .
|
|
|
|
|
Thanks to both. That makes very little sense to me.
If anyone knows a good *why* answer, I would love to hear it, but I will just use a cast.
Thanks,
*****************
"We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW
|
|
|
|
|
All integer expressions are computed using ints or larger, even if all the terms in it are bytes or shorts; that has been true in all C-like languages. The difference with C# is it complains when trying to store such expression result in anything smaller than int; C and C++ silently truncated the result, with a possible value error for free. In C# you need a cast, so you know you are responsible for a possible truncation.
try this (or its equivalent) in different languages:
ushort a=1;
ushort b=0xFFFF;
a++;
a=(ushort)(a+1);
b++;
b=(ushort)(b+1);
You may not like it, but this is how it has been defined.
The details can be found in section 7.2.6.2 of the C# language specification.
If you were to study the programming language you choose from a book, you would probably know such things.
|
|
|
|
|
Luc,
Thanks for your explanation. Not sure if the last line is meant condescendingly, but I value your input too much to complain . And your right. Its been a while since I really dug through my c# books. This is a PT thing for me. When it was FT, I did spend a lot more time in the books.
Thanks again.
*****************
"We need to apply 21st-century information technology to the health care field. We need to have our medical records put on the I.T." —GW
|
|
|
|
|
Dwayner79 wrote: Not sure if the last line is meant condescendingly
Not at all.
Too many people try and learn a language by experimenting, or reading a few things on the web, instead of really studying a book. A book tends to teach such stuff in a logic order, explaining how and why things are the way they are, and IMO there isn't really any alternative. And that's what I wanted to suggest.
|
|
|
|
|
I have some code that I'm trying to use to create a service on a remote machine. I am doing this:
static bool CreateService() {
try {
ManagementClass classInstance = new ManagementClass("root\\CIMV2", "Win32_Service", null);
ManagementBaseObject inParams = classInstance.GetMethodParameters("Create");
inParams["DesktopInteract"] = true;
inParams["DisplayName"] = "WallRotate";
inParams["ErrorControl"] = 0;
inParams["Name"] = "WallRotate";
inParams["PathName"] = "c:\\program files\\nts\\wallrotate\\wallclient.exe";
inParams["ServiceType"] = 16;
inParams["StartMode"] = "Automatic";
ManagementBaseObject outParams = classInstance.InvokeMethod("Create", inParams, null);
Write(outParams["returnvalue"].ToString());
} catch (Exception e) {
Write(e.Message.ToString());
return false;
}
return true;
}
...and it always fails. The outParams["returnvalue"] is 23. What other options can you get from the return on InvokeMethod? I was hoping to find something a little more, I dunno.. message-like? Hehe. "23" doesn't tell me much.
Thanks!
|
|
|
|
|
Apparently, you're trying to create a service that already exists on the machine. All you had to do was read the documentation on the Win32_Service class, Create method, here[^].
|
|
|
|
|
I have a listview and two bits fields (is_active) and (in_use) but it's showing on the ListView as True or False..
I am using this code to show in the ListView:
item.SubItems.Add(sql_reader["is_active"].ToString());
item.SubItems.Add(sql_reader["in_use"].ToString());
how can I change it to show as checkbox?
|
|
|
|
|
Checkbox is only available in Detail view of a listview.
You can add a listviewitem and use its checked property.
ListViewItem sitem = new ListViewItem();
sitem.checked = sql_reader["is_active"] as bool;
item.subitems.add(sitem);
This will do the trick I think...
|
|
|
|