|
I presume that you are using stored procedure. Write two select statements in stored procedure. This will return two datatables to dataset. Your stored procedure would look like this
SELECT * FROM yourtable WHERE Gender = 'M'
SELECT * FROM yourtable WHERE Gender = 'F'
When you fill this, you will get two tables in dataset with male and female details.
|
|
|
|
|
Write two different select statements.
|
|
|
|
|
Dear All,
My web Application include a lot of .cs page. Sometimes, they call each other. Is there any methods to find out all the name of the executed pages when we browse one page. There are the same base class and different page name for each page.
Thanks
|
|
|
|
|
Hi!
I'd like to attach to winmm.dll from C# (VS2005) and translated a few DLLImports from a very old VB6-Code i found on the internet. Some methods have callbacks and i don't know how to translate them.
The methods look like this:
public static extern int midiInOpen(ref int lphMidiIn, int uDeviceID, int dwCallback, int dwInstance, int dwFlags);
and
public void MidiIN_Proc(long hmIN, long wMsg, int dwInstance, int dwParam1, int dwParam2)
The method should somehow work like this:
midiInOpen(ref hMidiIN, mMPU401IN, <callback> 0, CALLBACK_FUNCTION);
The problem is, that in the original version dwInstance and dwCallback are pointers to methods. Unfortunately i have no clue how to use these DLL-calls in C#.
Can anybody tell me how to do these DLL-calls or provide some example-code=
Thanx a lot!
J.
|
|
|
|
|
Hi.
i think you will first have to declare a delegate with the paramters of the callback-function
<br />
public delegate void MidiCallBack(sometype someParameter);<br />
then declare the API - Call
<br />
[DllImport("winmm.dll")]<br />
public static extern int midiInOpen(ref int lphMidiIn, int uDeviceID, [MarshalAs(UnmanagedType.FunctionPtr)]MidiCallBack dwCallback, int dwInstance, int dwFlags);<br />
then you define the callback function with the same type
<br />
private void MidiCallbackFunction(sometype someParameter)<br />
{<br />
}<br />
and then you simply do
<br />
midiInOpen(ref hMidiIn, mMPU401IN, 0, new MidiCallBack(MidiCallbackFunction),0,0);<br />
hope this helps
greets
m@u
|
|
|
|
|
Theres a great site for .Net interop called pinvoke.net[^]. if you check down the lefthand side you'll see a winmm.dll node down at the bottom 
|
|
|
|
|
program and sql in same computer is ok,the connectstring is "DSN=pmtt_im;UID=pmtt_im;PWD=`".
program and sql dont in the same computer,what is the connectstring ?
|
|
|
|
|
What brand of database are you using?
You can go to connectionstrings.com[^] to find examples of connectionstrings for various databases and database drivers.
---
single minded; short sighted; long gone;
|
|
|
|
|
Is it possible to work with generic collections in crystal report?
I defined a generic list like this:
List<Employee> employeeList = new List<Employee>();
And now I want to bind this collection with crystal report and I don't know how crystal report can work with this collection fields in my employee class .
If anybody know please explain me ,how to do this.
Thank you very much .
DMASTER
|
|
|
|
|
I have developed a dll in C#.NET and I have used it in a VB project to make an ocx of it. if I use this ocx in a C#.NET project, there is no problem, but when I use it in the HTML page, it seems that the try-catch of the dll doesn't work, do you have any idea to solve this problem? s
|
|
|
|
|
hi to all,
I want to convert my MS Access databse/table in to an .xml file. How can I do it? help me.
Pravin
|
|
|
|
|
Its simple, read data in all the table and generate xml file...
|
|
|
|
|
can u plz send me example for this. I am new to c#.
Pravin
|
|
|
|
|
You should start with easier tasks if you're new to C#.
|
|
|
|
|
I use these code to generate a xml file(i use SqlServer2005 for the DB), for example:
string MyConn = ConfigurationManager.ConnectionStrings["Connect"].ConnectionString;
SqlConnection conn = new SqlConnection("MyConn");
string SqlStatement = "SELECT * FROM my_table"
SqlDataAdapter adapt = new SqlDataAdapter(SqlStatement,conn);
DataSet ds = new DataSet();
DataTable dt = new DataTable("my_table");
adapt.Fill(dt);
ds.Tables.Add(dt);
ds.WriteXml (@"..\..\myXmlFile.xml")
After that build and execute u'r application.In windows explorer,Locate and Find u'r xml file on u'r project folder..Hope Can Help U
Best Regards,
Tomi
|
|
|
|
|
|
Hi,
I want to save a few arraylist into a file. One method that i found out is to use serializable. However, below is the exception error when i try to save the window form.
Additional information: The type System.Drawing.Drawing2D.GraphicsPath in Assembly System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken.... is not marked as serializable.
The program is able to draw shapes into a panel and it has shape classes(e.g. rect class,polygon class...) in those classes it uses graphicspath to add the shapes onto the panel. besides that, one of the arraylist also contains Graphicspath. I'm able to serialize the arraylist other than those that use GraphicsPath. So, can anybody help me to explain what i should do to solve this problem?
Thanks in advance to anybody who is willing to lend a helping hand
|
|
|
|
|
everything is going to be serialized must have Serializable Attribute in .Net but GraphicsPath class does not have it so you can't direcly Serialize it however there are some ways to do that
I saw a constructor for GraphicsPath Takes 3 arguments (PointF[] points ,byte[] types ,FillMode fillMode)
and of course three Property from GraphicPath instance FillPoints:pointF[] ,PathTypes:byte[] ,FillMode:FillModeEnum
all of these three type are marked as serializable so you can serialize these data and then desrialize them and create a new GraphicsPath instance identical to the Serialized one.
Code some like this
<br />
<br />
[Serializable]<br />
class GraphicsPathData<br />
{<br />
byte[] types;<br />
PointF[] points;<br />
FillMode fillMode;<br />
<br />
public GraphicsPathData(GraphicsPath gp)<br />
{<br />
this.types = gp.PathTypes;<br />
this.points = gp.PathPoints;<br />
this.fillMode = gp.FillMode;<br />
}<br />
<br />
public static System.IO.Stream Serialize(GraphicsPathData gpd)<br />
{<br />
System.IO.MemoryStream ms=new System.IO.MemoryStream();<br />
<br />
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();<br />
<br />
bf.Serialize(ms, gpd);<br />
ms.Flush();<br />
return ms;<br />
}<br />
<br />
public static GraphicsPathData Deserialize(System.IO.Stream stream)<br />
{<br />
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();<br />
<br />
object obj=bf.Deserialize(stream);<br />
GraphicsPathData gpd =obj as GraphicsPathData;<br />
return gpd;<br />
}<br />
<br />
public static GraphicsPath GetGraphicsPath(GraphicsPathData gpd)<br />
{<br />
return new GraphicsPath(gpd.points, gpd.types, gpd.fillMode);<br />
}<br />
<br />
public static GraphicsPath GetGraphicsPath(System.IO.Stream gpdStream)<br />
{<br />
return GetGraphicsPath(Deserialize(gpdStream));<br />
}<br />
}<br />
<br />
and I tested that like
<br />
<br />
GraphicsPath gp = new GraphicsPath();<br />
gp.AddEllipse(10, 10, 100, 100);<br />
<br />
GraphicsPathData gpd = new GraphicsPathData(gp);<br />
System.IO.Stream gpdStream = GraphicsPathData.Serialize(gpd);<br />
<br />
<br />
System.IO.Stream newStream = new System.IO.MemoryStream(((System.IO.MemoryStream)gpdStream).ToArray());<br />
<br />
GraphicsPath gpDeserialized = GraphicsPathData.GetGraphicsPath(newStream);<br />
<br />
Good Luck
|
|
|
|
|
Hey, thanks for the great reply.
However if i got an 3 arraylist to be serialize, one of them is an arraylist containing graphicspath, how do i deserialize them back to the 3 different arraylist. Should i save the number of items in each of the arraylist?
Below is how i put all the arraylist into a single arraylist
ArrayList arr = new ArrayList();<br />
<br />
arr.Add(Arraylist1);
for(int i=0;i<ArrayList2.Count;i++)
{<br />
GraphicsPathData gpd = new GraphicsPathData((GraphicsPath)PathList[i]);<br />
Stream gpdStream = GraphicsPathData.Serialize(gpd);<br />
arr.Add(gpdStream);<br />
}<br />
<br />
arr.Add(Arraylist1);
<br />
formatter.Serialize(myStream, arr);<br />
myStream.Close();<br />
What other method do you suggest?
Thanks in advance
|
|
|
|
|
The thing you are doing is going to work and is ok
and Yes if you are using arrays you must know what data is where
for preventing this you can use HashTable and use Enum or string names for keys
these are wrote down here are just suggestions
how about to create a GraphicsPathDataCollection Class and pass those GraphicsPaths to it and Serialize/ Deserialize the GraphicsPathDataCollection and take back your array of GraphicsPath after Deserializing.
this needs some coding but is the correct way because you have a collection and maybe some other time you simply modify it for other use (like import and export...)
there is an easier way too just like you did, but you can put all your GraphicsPathData inside a ArrayList not their serialized streams then Serialize the Array because as you know serializing is not such a fast job exeptionaly if you use SoapFormatter and in this way lots of resources going to be wasted.
and one another thing if you are using .Net2.0 why we don't use List<> instead of ArrayList if all of our data are the same!.
enum myPhases {gpData /*and other things you need to serialize */};
HashTable tableMustbeSerialized=new HashTable();
List<GraphicsPath> gpList; //your Graphicspaths
List<GraphicsPathData> gpdList=new List<GraphicsPathData>();
foreach(GraphicsPath gp in gpList)
gpdList.Add(new GraphicsPathData(gp));
.
.
.
//other things must be Serialized
tableMustbeSerialized.Add(myPhases.gpData ,gpdList);
.
.
.
//add other Data too
formatter.Serialize(myStream, tableMustbeSerialized);
myStream.Close();
and of course after deserializing it can be easier retrieved
object deserializedObject;
HashTable myData=deserializedObject as HashTable;
List<GraphicsPathData> gpdList=myData[myPhases.gpData] as List<GraphicsPathData>;
if you need help I'm here
good luck
|
|
|
|
|
Hi,
I created a VC++ MFC static Dll and wrote a function with __decl(dllexport).Then I created C# wrapper on top of the VC++ MFC Static DLL and tried to call the method in wrapper DLL through a sample windows application in C#.But i could not proceed as i got an errer i.e. Unable to find entry point for that menthod.
|
|
|
|
|
there is a property called allow paging =true, in vb.net datagidview.
can i directly allow the paging =ture in c# datagidview.
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
what application did u build?
a Web Apps or a Win App
Regards,
Tomi
|
|
|
|
|
window app
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
Since you said below that it is a Windows application, I don't know how you found an AllowPaging property in VB.NET. Properties are not artefacts of the language you are using, but of a class. A control, like the DataGridView, has the same properties whatever language it is used in, and the Windows forms DataGrid view doesn't have an AllowPaging property at all.
"Once in Africa I lost the corkscrew and we were forced to live off food and water for weeks." - Ernest Hemingway
My New Blog
|
|
|
|