|
Yes, there are classes around that do this. The fotovision sample contains some examples, in VB.NET.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks Christian!
where can i find the fotovision sample please?
best regard
Adiphe
"...all is simple, but there is always simpler ..."
|
|
|
|
|
|
Hi to all!
A short question:
Is it possible, to use an object,list,array or something like that as a database?
So I want to run SQL like queries on my object.
Ex.
I have a list, witch contains Person object (List<person> Persons)
Person class for ex.:
<br />
class Person<br />
{<br />
private int _id;<br />
public int ID<br />
{<br />
get{return _id}<br />
}<br />
private string _name;<br />
public string Name<br />
{<br />
get{return _name}<br />
}<br />
}<br />
I want to run a select for those persons who have id under 10 like this: SELECT * FROM Persons WHERE ID<10
How can I do this?
I try it witd bindingsource, try to add my class as project datasource, but nothing work
Thanks for help.
|
|
|
|
|
|
Thank's for quick replay.
I do this way, some times ago, but now, I wont write all the search, and filter method by hand.
Becouse of the complex querys, witch generated at runtime, as the user wants.
Ex.:
somethimes I ned a quer like this:
select * from partners where id<10 and name like'Mr.%' .....
and somethimes need group by option too.
|
|
|
|
|
Dear all,
I used below lines to achieve some results from the Sql Server 2000 database.
My question is why there are always 2 Process ID created for one "adapter.Fill()" method even the connection is disposed.
The Process ID created will disappear after the application exits.
Thanks for your attension.
System.Data.DataTable tb = new System.Data.DataTable();
SqlDataAdapter adapter = new SqlDataAdapter();
SqlConnection conn = new SqlConnection(connectionstring);
adapter.SelectCommand = new SqlCommand( "brm_sel_rackstatus", conn);
adapter.SelectCommand.CommandType = CommandType.StoredProcedure;
adapter.SelectCommand.Parameters.Add("@rack",SqlDbType.Int,32);
adapter.SelectCommand.Parameters.Add("@startcol",SqlDbType.Int,32);
adapter.SelectCommand.Parameters.Add("@endcol",SqlDbType.Int,32);
adapter.SelectCommand.Parameters[0].Value = this.rack;
adapter.SelectCommand.Parameters[1].Value = this.startcol;
adapter.SelectCommand.Parameters[2].Value = this.endcol;
adapter.Fill(tb);
adapter.Dispose();
conn.Dispose();
coby
|
|
|
|
|
ADO.NET supports connection pooling - it will keep connections that have been used open. That would explain one of the connections, but not the second.
It is possible to configure a minimum pool size in the connection string. The other possibility I can think of is that this method is being called concurrently on another thread - are you using a System.Threading.Timer ? That class does not check if the timer method is already running - it always runs the timer method when the timer expires, even if a previous call has not finished yet.
|
|
|
|
|
Hi, Chris,
Thanks for the response. It seems that SqlDataAdapter.Fill() will create 2 connections. I don't run a Timer in the program.
The first connection is used to run the command I set while the second one seems to run nothing and the Last Batch column in Sql Server 2000 Agent/Current Activity is "1900-1-1 0:00:00". I have tried to kill it and found the program still run well. It seemed to be a junk connection. Do you know how I can remove it from my program.
Thanks,
coby
coby
|
|
|
|
|
Hi.i am trying to compare today 's date with a date from database.if it found like today 's date is available from database it should return something like eventname.here is my code
string Today = DateTime.Now.ToShortTimeString().ToString();
SqlCommand cmdDisplay = new SqlCommand();
cmdDisplay.Connection = conn;
cmdDisplay.CommandText = "SELECT EventName FROM Events WHERE EventDate = '"+ Today + "'";
SqlDataReader dr = cmdDisplay.ExecuteReader();
while(dr.Read())
{
string EDate;
EDate = dr["EventDate"].ToString();
if(EDate == Today)
{
txtEventName.Text =dr["EventName"].ToString();
}
}
|
|
|
|
|
You're storing dates as strings in the ShortTimeString format ? That's a time, not a date. And, it's an inefficient way to store them. And it's redundant - you ask for only for values with a specific time, and then you check to make sure your database is not lying to you ?
I don't see a question here - what is the problem ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Dear programers
i hav application having forms
when user press f1 respective form displayed from .chm file.
i have used Help.ShowHelp(this,filepath,keyword)
i want to add a feature if user press F1 on button then in form the selected topic should be highligted
how can i do it
i will appriciate ur comments
sikandar
|
|
|
|
|
hi Guys,
i have to send xml files via MSMQ. I am very new to this.
Can anyone guide me for this?
---------------
I dynamically create XML file and try to save it on share folders and as well as try to send to destination server via MSMQ. XML file is generating without any error.
-----------------------------------------------
I have given the code what i have written (code in C#.net 2003). It's not giving me any error, but as well as not sending file also.(transfer would be one server to other server. and both server is in different domain. I can access destination server from source server- Ping servername)
string QueuePath = @"FormatName:DIRECT=OS:server \private$\DEVqueSERVICE";
MessageQueue queueA = new MessageQueue(QueuePath);
file = new FileStream(fullName,FileMode.Open,FileAccess.Read,FileShare.Read);
XmlTextReader xtr = new XmlTextReader(file);
System.Messaging.Message msg = new System.Messaging.Message();
msg.Label=getcounter();
StreamWriter wr = new StreamWriter(msg.BodyStream,System.Text.Encoding.Unicode);
wr.Write(file);
wr.Flush();
try
{
queueA.Send(msg, MessageQueueTransactionType.Single);
}
catch
{
}
finally
{
queueA.Close();
}
|
|
|
|
|
Hello,
Is it possible to format an USB Stick (drive) with an ManagementObject or something else?
Thanks for help!
Martin
|
|
|
|
|
Salam
we have a public static variable lets say temp in a class lets say A and another class lets say B creates a thread that will update temp's value after every 10 seconds by getting values from Data base.And another thread of the same class uses updated values of temp.Now the problem is this that ,
we are not getting updated values of temp in the second thread of the classB.can any body figure out the problem in this scenario.
plz I need an urgent reply.
thanks
|
|
|
|
|
Use lock when you access the variable, or declare it as volatile .
samtam wrote: I need an urgent reply.
Are you sure that the reply should be urgent, or is it perhaps that it is needed urgently?
---
b { font-weight: normal; }
|
|
|
|
|
Thanks,
But we have already used Monitor.Enter and Monitor.Exit methods for locking mechanism, but it doesnt work.
So now???????????
Urgent Reply is needed urgently!!!!!!!!!!!
|
|
|
|
|
That should do it. Are you using it both when reading and writing the value? Are you locking on the same object?
---
b { font-weight: normal; }
|
|
|
|
|
Ofcourse we are locking the same object and using it both reading and writing times. we used Monitor.TryEnter at the time of reading that object. which provides exclusive lock.
|
|
|
|
|
If you have done it right, then it works. So the conclusion is...?
What does the code look like?
---
b { font-weight: normal; }
|
|
|
|
|
its not possible to send u the whole code related to this coz its too long so only sending u chunks from it,i hope it will help u to understand our problem
//this method is called after every 10 seconds by timer event
public void ConnectDB(Object obj, EventArgs ev)
{
myTimer.Stop();
String query = "/////////////some selection from DB";
aReader = DB.ExecuteReader(query);
projectDB.Clear();
while (aReader.Read())
{
//structure is a Struct containing a string and an int variable
//after gettings latest values from db in structure v add it
// in projectDB arraylist
structure.proj_name = aReader.GetString(0);
structure.compl_status = aReader.GetInt32(1);
//to lock the projectDB array list here
Monitor.Enter(projectDB);
projectDB.Add(structure);
//to unlock the projectDB arraylist here
Monitor.Exit(projectDB);
}
DB.Close();
if (!list_status.Contains(s))//some check i think u dnt need to understand it
{
exit_flag = true;//to disable timer
}
else
{
myTimer.Enabled = true;//to enable timer
}
}
another method of the same class that is using value of this arraylist
///////////////code where v r reading values from projectDB
if (Monitor.TryEnter(projectDB))
{
//projectDB is an arraylist filled with info from database
temp_projDB = (compile_status)projectDB[index];
}
else
continue;
//////////////////
Thanks
|
|
|
|
|
I see three problems with the code:
1. You clear the list outside the monitoring.
2. You enter and leave the monitoring for each item you add, leaving the list in different state every the time.
3. You never leave the monitoring when you read from the list.
---
b { font-weight: normal; }
|
|
|
|
|
I have made a windows service and deployed it using installutil utility. Now i want to remove it as i have to make some changes in the original service. How can i remove the service.
I have another problem. Whenever we pass an insert statement against database table the exception can be cathced by using sqlexception parameter. I have done with exception where there is a problem with the primary key because i know the error code it genereates when there is a primary key error. But how can i do the same type of checking when there is an error related to foreign key. Wht is the error code for foreign key related errors.
Any suggestion is well received. thanx in advance
|
|
|
|
|
To uninstall windows service use installutil/u from your visual studio command prompt like installutil/u <your assembly="" name="">
and for the next one i hope you should ask in sql forum.
Luck is Opportunity with hardwork
|
|
|
|
|
How to get the values of some properties in the class
Like I have a Class ... Class1 in which some properties are defined say FName, LName..
What I want is that I want to apply this thing to many classes of which I don't know the properties that it contains as in....
in class1 it may be FName or LName
but what is in class 2 I don't know
I want to have some common code that will apply for all the classes I want.
the problem with this one is that here I have to call the values of all the properties individually
How can I do this?
Please reply.
Thanks in Advance
Parag Gupta
|
|
|
|