Click here to Skip to main content
15,891,136 members
Home / Discussions / C#
   

C#

 
AnswerRe: Enum Member PinPopular
Pete O'Hanlon22-Apr-10 2:01
mvePete O'Hanlon22-Apr-10 2:01 
GeneralRe: Enum Member Pin
DIPAK@EMSYS22-Apr-10 2:05
DIPAK@EMSYS22-Apr-10 2:05 
GeneralRe: Enum Member Pin
PIEBALDconsult22-Apr-10 4:54
mvePIEBALDconsult22-Apr-10 4:54 
AnswerRe: Enum Member Pin
PIEBALDconsult22-Apr-10 4:57
mvePIEBALDconsult22-Apr-10 4:57 
Questionsending the value of a parameter in a form to another form smart device Pin
bacem smari22-Apr-10 0:25
bacem smari22-Apr-10 0:25 
AnswerRe: sending the value of a parameter in a form to another form smart device Pin
Sandesh M Patil22-Apr-10 2:19
Sandesh M Patil22-Apr-10 2:19 
GeneralRe: sending the value of a parameter in a form to another form smart device Pin
bacem smari22-Apr-10 3:39
bacem smari22-Apr-10 3:39 
Questionstore the results of a WMI requests in a SQLite database Pin
hafsaben22-Apr-10 0:02
hafsaben22-Apr-10 0:02 
Hello
I am a beginner in programming in c #, I am trying to program a windows service that has as role of a PC scanner and collect information from WMI such as (disk space, machine name ...), and store these data in a SQLite database that I already create.I've managed to make the WMI connection and SQLite database but I wanted to know how do I do to store the results I get from WMI directly into my SQLite database.
Does anybody have an idea?
Thank you.

////////////connexion Wmi///////////////////

ConnectionOptions conop = new ConnectionOptions();
ObjectQuery query = new ObjectQuery("SELECT Name,Manufacturer,SerialNumber

from Win32_BaseBoard");
ManagementObjectSearcher searcher = new ManagementObjectSearcher(query);
ManagementObjectCollection queryCollection = searcher.Get();

///////////connexion sqlite////////////////////

using (DbConnection cnn = new SQLiteConnection("Data Source=import.db3"))
using (DbCommand cmd = cnn.CreateCommand())
{

cnn.Open();
cmd.CommandText = "CREATE TABLE carte_mére (Name VARCHAR(50),Manufacturer

VARCHAR(50),SerialNumber VARCHAR(50))";
cmd.ExecuteNonQuery();


foreach (ManagementObject m in queryCollection)
{

try
{
SQLiteDataAdapter adapter = new SQLiteDataAdapter(req,cnn);

adapter.InsertCommand = new SQLiteCommand("insert into carte_mére

Name,Manufacturer,SerialNumber values

(@Name,@Manufacturer,@SerialNumber)");
adapter.InsertCommand.Parameters.AddWithValue("@Name", d);
adapter.InsertCommand.Parameters.AddWithValue("@Manufacturer",

m.Properties["Manufacturer"].Value.ToString());
adapter.InsertCommand.Parameters.AddWithValue("@SerialNumber",

m.Properties["SerialNumber"].Value.ToString());
adapter.InsertCommand.ExecuteNonQuery();

} //Console.ReadLine();
catch (Exception)
{
Console.WriteLine("error");
}
QuestionChanging the disposition of my listView.items in csharp smart device [modified] Pin
Tunisien8621-Apr-10 23:40
Tunisien8621-Apr-10 23:40 
AnswerRe: Changing the disposition of my listView.items in csharp smart device Pin
Tunisien8622-Apr-10 5:27
Tunisien8622-Apr-10 5:27 
QuestionCreating Database and assigning DataSet shema to the Data Source Pin
pandit8421-Apr-10 23:20
pandit8421-Apr-10 23:20 
AnswerRe: Creating Database and assigning DataSet shema to the Data Source Pin
Dave Kreskowiak22-Apr-10 6:21
mveDave Kreskowiak22-Apr-10 6:21 
QuestionHow to add XmlInclude attribute dynamically Pin
Anindya Chatterjee21-Apr-10 23:09
Anindya Chatterjee21-Apr-10 23:09 
QuestionCross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
jkpieters21-Apr-10 22:59
jkpieters21-Apr-10 22:59 
AnswerRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
Anindya Chatterjee21-Apr-10 23:12
Anindya Chatterjee21-Apr-10 23:12 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
Jimmanuel22-Apr-10 0:58
Jimmanuel22-Apr-10 0:58 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
Luc Pattyn22-Apr-10 1:32
sitebuilderLuc Pattyn22-Apr-10 1:32 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
Luc Pattyn22-Apr-10 1:34
sitebuilderLuc Pattyn22-Apr-10 1:34 
AnswerRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
Jimmanuel22-Apr-10 1:05
Jimmanuel22-Apr-10 1:05 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
jkpieters22-Apr-10 1:21
jkpieters22-Apr-10 1:21 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
Dave Kreskowiak22-Apr-10 2:11
mveDave Kreskowiak22-Apr-10 2:11 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
Jimmanuel22-Apr-10 3:12
Jimmanuel22-Apr-10 3:12 
GeneralRe: Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on. Pin
Anindya Chatterjee22-Apr-10 2:13
Anindya Chatterjee22-Apr-10 2:13 
Question2 tables in 2 DataGridViews on a single form Pin
shivapriyak21-Apr-10 22:51
shivapriyak21-Apr-10 22:51 
AnswerRe: 2 tables in 2 DataGridViews on a single form Pin
sanforjackass22-Apr-10 0:12
sanforjackass22-Apr-10 0:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.