15,883,705 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by mrDivan (Top 65 by date)
mrDivan
15-Jul-15 3:12am
View
You could try the following
public class WinDevices
{
static public List<deviceinfo> GetUSBDevices()
{
List<deviceinfo> devices = new List<deviceinfo>();
ManagementObjectCollection collection;
using (var searcher = new ManagementObjectSearcher(@"Select * From Win32_PnPEntity"))
collection = searcher.Get();
foreach (var device in collection)
{
var deviceInfo = new DeviceInfo();
deviceInfo.DeviceID = (string)device.GetPropertyValue("DeviceID");
deviceInfo.PNPDeviceID = (string)device.GetPropertyValue("PNPDeviceID");
deviceInfo.Description = (string)device.GetPropertyValue("Description");
deviceInfo.Name = (string)device.GetPropertyValue("Name");
deviceInfo.Caption = (string)device.GetPropertyValue("Caption");
deviceInfo.Service = (string)device.GetPropertyValue("Service");
devices.Add(deviceInfo);
// Other properties supported by Win32_PnPEntity
// See http://msdn.microsoft.com/en-us/library/aa394353%28v=vs.85%29.aspx
//var keys = new string[] {
// "Availability",
// "Caption",
// "ClassGuid",
// "CompatibleID[]",
// "ConfigManagerErrorCode",
// "ConfigManagerUserConfig",
// "CreationClassName",
// "Description",
// "DeviceID",
// "ErrorCleared",
// "ErrorDescription",
// "HardwareID[]",
// "InstallDate",
// "LastErrorCode",
// "Manufacturer",
// "Name",
// "PNPDeviceID",
// "PowerManagementCapabilities[]",
// "PowerManagementSupported",
// "Service",
// "Status",
// "StatusInfo",
// "SystemCreationClassName",
// "SystemName"
//};
}
collection.Dispose();
return devices;
}
public class DeviceInfo
{
public string Name { get; set; }
public string DeviceID { get; set; }
public string PNPDeviceID { get; set; }
public string Description { get; set; }
public string Caption { get; set; }
public string Service { get; set; }
}
}
Kind regards
Divan
mrDivan
15-Jul-15 3:07am
View
Good day
Please set the EnableViewState="true" on your control in your aspx page.
Kind regards
Divan
mrDivan
15-Jul-15 2:34am
View
Thank you for your reply.
I connect to a sql remote database from my machine and from the remote server.
mrDivan
2-Jul-15 3:41am
View
Anyone else have any ideas
mrDivan
1-Jul-15 7:11am
View
Hallo thank you for your quick response. Do you perhaps have an example of how to encrypt an attribute.
Kind regards
Divan
mrDivan
17-Feb-15 3:20am
View
Hi no only the order numbers which don't have a status 9 so O1 and o3
mrDivan
17-Feb-15 2:35am
View
Sorry I have edited it I mean columns I cannot use = because it will return everything I need to now which ones have a status 8 but not a 9 status
Kind regards
mrDivan
22-Jan-15 5:28am
View
tblTmpProductDetails will always have more than one record so if found the hole in my logic. I will have to loop trough each record in the tblTmpProductDetails table and for each record do the insert into the tblCustomer table
mrDivan
30-Sep-14 3:38am
View
Thank you so much it worked I really appreciate it
mrDivan
14-Aug-14 8:57am
View
webform
mrDivan
14-Aug-14 4:28am
View
Hi thank you for your response. I tried but the method doesn't get executed
mrDivan
14-Aug-14 4:03am
View
Sorry
mrDivan
30-May-14 3:35am
View
Thank you So much after hours of coding sometimes it helps to have an outside view because we miss the small things
mrDivan
27-Feb-14 8:53am
View
Good day Dave
Here is my scenario: when the user logs in I want to immediately change his password email his new password to him update his password and expiry date in active directory. I have learned how to change the password in ad Im just looking for a way to detect the login
I know my explanation is basic but I am just trying to find out if it is possible
Kind regards
mrDivan
27-Feb-14 8:24am
View
Good day Sergey
Here is my scenario: when the user logs in I want to immediately change his password email his new password to him update his password and expiry date in active directory. I have learned how to change the password in ad Im just looking for a way to detect the login
I know my explanation is basic but I am just trying to find out if it is possible
Kind regards
mrDivan
27-Feb-14 8:19am
View
Thank you will one be able to see username
Kind regards :)
mrDivan
19-Feb-14 6:01am
View
I fixed it just need to rethink the process
mrDivan
19-Feb-14 5:29am
View
thanks
mrDivan
18-Feb-14 6:41am
View
Thanks but it didnt work
mrDivan
27-Sep-13 8:30am
View
Im not looking for this solution I am trying to scroll a div only not the entire page but thank you anyway
mrDivan
22-Aug-13 4:56am
View
Thanks but it is not working
mrDivan
20-Jan-13 7:52am
View
thank you
mrDivan
20-Jan-13 7:32am
View
hallo originalGriff thank you so much for your response the question is I have to handle the nullreference exception an the error input example"test" I do not know the type of the input
public string BuildList(object[] input)
{
string result = null;
for (int i = 0; i < input.Length; i++)
{
if (input[i] != null)
{
result = result + input[i].ToString() + ", ";
}
else
{
result = "error";
}
}
return result;
}
mrDivan
20-Jan-13 7:12am
View
Can anyone help me
mrDivan
20-Jan-13 6:57am
View
Hi THANK YOU FOR YOUR HELP yes i tried it works but doesn whant to give me an error when input[i]= test it should then show error only when input[i]= test and not 1or 2or3
mrDivan
9-Jan-13 5:28am
View
hallo thank you for your response the problem is that it does not save the updated value back to dt//the datatable
mrDivan
9-Jan-13 5:24am
View
thanks for your response Sandeep im trying to write the edited value of celldata back to the in memmory table for that row
mrDivan
9-Jan-13 4:40am
View
Hi im trying to change the value of celldata and then write that back to the datatable(in memmry)
mrDivan
21-Dec-12 4:54am
View
thank you
mrDivan
21-Dec-12 4:53am
View
thank you so much it worked
mrDivan
21-Dec-12 3:58am
View
Hi no its an asp.net application
mrDivan
21-Dec-12 3:49am
View
yes that is correct
mrDivan
21-Dec-12 3:36am
View
Hi thanks for your answer I really appreciate your time can you maybe tell me how to use the background worker to do this I have no experience in using a background worker
mrDivan
20-Nov-12 3:33am
View
Thank you forgot about he postback thank you for your time spent helping me
mrDivan
7-Nov-12 5:37am
View
ok thank you will give it a try
mrDivan
7-Nov-12 5:22am
View
Sorry jim just a question should I change the gridview in the foreach loop depending on which gridview i want to be able to select
mrDivan
7-Nov-12 4:50am
View
Thank you so much I appreciate it tremendously it worked first time.
mrDivan
31-Oct-12 10:12am
View
Hi marcus my other table depends on it to be a primary key the group table has 5 columns company_Name pk,user_Name pk,groups pk, description,shared
the table has many to many relationship to my other table which has the following columns company_Name pk user_Name pk,groups pk, cellNo pk ,title,name ,ref
the 1 table has foreign key relationships to the first tables primary keys
mrDivan
30-Oct-12 10:42am
View
Thank you it worked
mrDivan
23-Oct-12 4:02am
View
Hi Again
It works if I run this in Microsoft sql on the database but when I run the same statement on the same database in mySql it doesnt return any results
mrDivan
23-Oct-12 3:54am
View
ThaNKS IT DOESNT WORK
mrDivan
23-Oct-12 3:53am
View
Hi Again
It works if I run this in Microsoft sql on the database but when I run the same statement on the same database in mySql it doesnt return any results
mrDivan
22-Oct-12 8:50am
View
hallo here is my code
MySqlCommand sqlC = new MySqlCommand("select * from T_users where Active like @filterText and where Company_Name = '" + CompanyName + "' ", myconfill);
sqlC.Parameters.AddWithValue("@filtertext", '%' + txtFilter.Text + '%');
MySqlDataAdapter da = new MySqlDataAdapter(sqlC);
DataSet ds = new DataSet();
da.Fill(ds);
gdvauthors.DataSource = ds;
gdvauthors.DataBind();
myconfill.Close();
mrDivan
22-Oct-12 8:48am
View
Hi Thank you No I know how to pass the session varaibles to the sql the problem is with mySql statememt and how to get it to work with the like statement returning more than one value
mrDivan
22-Oct-12 7:47am
View
Hallo thank you for your help it does have a wildcart in the variable so that works the problem is lets say I have a database with a company 4 users and each user has 4 recipients lets say user 4 has the following recipients Abe, Andrew, Allan and bart the user then types in an a in the filtertextbox to fillter on lets say he wants to return all the names containing an a then it will return Abe,Andrew and allen the problem Im expreriencing is my select statement will then look like this
select * from t recipients where CompanyName = @CompanyName"this is an session variable" and UserName = @UserName"this is an session variable" and recipient like @ filtertext "which is now Abe, Andrew, Allan" so there is the problem I just dont know how to fix it
mrDivan
18-Oct-12 11:05am
View
Hi sorry yes I do use that my problem is in the logic the code works but if i Filter on say ex a the value of @filter can be more than one if there is more than one user with a username containing an a so then my statement never returns a value because the and doesn work but if n run the the statement without the where company_Name = @Company name then it does return results but it does then reutn results for the whole table and not just where comapnay name = @company Name
mrDivan
12-Oct-12 2:43am
View
Ho I changed the parameters back to@filterlist but it doesnt work but thanks for your help anyway
mrDivan
11-Oct-12 10:59am
View
Hi Marcus
Thank you for your response
here is my code im trying to use the selected value from a dropdown list as a variable but that seems broken
protected void btnFilter_Click(object sender, EventArgs e)
{
string filterlist = ddFillist.SelectedItem.Value;
string filterText = " % " + txtFilter.Text + "%";
MySql.Data.MySqlClient.MySqlConnection myconfill = new MySqlConnection(GetConnectionString());
if (myconfill.State != ConnectionState.Open)
try
{
myconfill.Open();
}
catch (MySqlException ex)
{
throw (ex);
}
// where ?filterList like ?filterText
MySqlCommand sqlC = new MySqlCommand("select * from T_company where ?filterlist like ?filterText ", myconfill);
MySqlDataAdapter da = new MySqlDataAdapter(sqlC);
sqlC.Parameters.AddWithValue("?filterlist", filterlist);
sqlC.Parameters.AddWithValue("?filtertext",'%'+txtFilter.Text+'%');
DataSet ds = new DataSet();
da.Fill(ds);
gdvauthors.DataSource = ds;
gdvauthors.DataBind();
myconfill.Close();
}
if i change ? filterlist with company_name it works seems like im somehow not giving my parameter the right vale
mrDivan
11-Oct-12 7:54am
View
i have 11 columns and company_name is my primary key
mrDivan
11-Oct-12 4:19am
View
Im sorry I dont understand could you give me an example
mrDivan
8-Oct-12 10:29am
View
Thanks for the advice but it still does not update the values in my database
mrDivan
8-Oct-12 5:38am
View
yes it is an column that holds the primary key values i am trying to update that value
mrDivan
18-Sep-12 6:25am
View
Thank you
mrDivan
4-Sep-12 5:06am
View
i keep getting this error
The name 'fileuploadExcel' does not exist in the current context
mrDivan
4-Sep-12 4:51am
View
sorry here is the right code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<span style="color: Red">*</span>Attach Excel file
</td>
<td>
<asp:fileupload ID ="fileuploadExcel" runat="server" />
</td>
</tr>
<tr>
<td></td>
<td>
<asp:Button ID="btnSend" runat="server" Text="Export" onclick="btnSend_Click" />
</td>
</tr>
</table>
<asp:GridView ID="GridView1" runat="server">
</div>
</form>
</body>
</html>
mrDivan
4-Sep-12 4:42am
View
Hi here is my other code could you please tell me where would u put the fileupload
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="CSharpUpload.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" enctype="multipart/form-data" runat="server">
<INPUT type=file id=File1 name=File1 runat="server" >
<br>
<input type="submit" id="Submit1" value="Upload" runat="server" NAME="Submit1">
</form>
</body>
</HTML>
mrDivan
30-Aug-12 2:49am
View
Ok thank you
mrDivan
27-Aug-12 10:57am
View
i have updated the code
Thanks
mrDivan
27-Aug-12 10:55am
View
thanks i tried it the problem is it only returns SqlServer.Form1 + sqlserverlist
mrDivan
27-Aug-12 9:50am
View
it only adds Sqlserver.form1 SqlSeverList
in the listbox
mrDivan
27-Aug-12 8:13am
View
listBox2.DataSource = AllInstanceSqlserver; this is what i did but it does not add the items in the list box
mrDivan
27-Aug-12 7:39am
View
How would I display it in an list view
mrDivan
20-Aug-12 4:34am
View
thank you
mrDivan
20-Aug-12 4:33am
View
thank you
mrDivan
20-Aug-12 4:33am
View
Hi Amit thanks for your response
How do i encrypt my web config file and will this not make it slower because at has to decrypt everytime.
Am I correct in saying that they will not have access to the .csfiles
Show More