|
nidhelp wrote:
i did databiding of controls to my table columns, but it's not showing when i run my app..
How do you retrived the data and did data binding?
MCAD
|
|
|
|
|
what i did was only go to my textboxes/radio btns/combo boxes' properties>(databinding)>(advanced)>text>select in treeview mydataset>fieldname... in data adapter preview i can see all the users' data displayed... how do i only show a chosen user's data in textboxes/radio btns/combo boxes when i run the app.. i've a textbox for user to key in ID No. and a ok button.. can my ok button represent a load button to load the data of user whose ID no. was entered in text box? how do i go on exactly?
i've read articles already.. i learn when i actually do it, reading helps to clear some of my doubts but hands-on helps me learn faster and easier... please give me some real guidance if you are free, ok??
i suppose i still have a lot to do to achieve what i want... im rushing against time!! please help...
Thanks!!
|
|
|
|
|
I hope i understood what you need correctly
You want to display the data for the user which have Specific ID Is this OK?
if yes
if you got all the data of customer table for example into DataSet to filter the data by customer ID
Dataset DefaultView have Filter Property which you can set
And it will be filter the data
some thing like that
DataSet.Customers.DefaultView.RowFilter="CustomerID='XYZ'" ;
This will display onley the data of customer who have customerID='xyz'
So modify this code to work in your case
The other thing get the data you need only dont return all table and you really need few records to do this dont use some thing like
SELECT CustomeID,CustomerName,.. FROM Customers
You can get the data you only need by add Where Clause
like SELECT CustomeID,CustomerName,.. FROM Customers Where CustomerID='xyz'
MCAD
|
|
|
|
|
hi
you see, when i use data form wizard, the form just pop-up across my screen as i used the show form method.. my most important need now is to be able to place my form that i had generated from data form wizard INTO a tab page... i tried to copy and paste the form controls over to a tab page, the result was that the form could not load.. i want the form to be placed in a tab page which i've already created and is working well..
PLEASE help me...
thanks
|
|
|
|
|
I have searched the message board and found nothing. I want to insert from a DataSet into a Table in my DB.
I create the dataset and from there would like to insert a column from the dataset into a table I have created in the DB.
A point in the right direction or any help would be appreciated.
Scott Moore
|
|
|
|
|
Use DataAdapter and CommandBuilder. MSDN has all the information you need.
Live Life King Size
Alomgir Miah
|
|
|
|
|
As Alomgir Said you can Use DataAdabter and CommandBuilder
But at first i think you need to read tutorial or book about ado.net for now you need to do somthing like this
SqlDataAdapter da = new SqlDataAdapter(selectSql, connString);
SqlCommandBuilder cb = new SqlCommandBuilder(da);
da.Fill(ds, "Customers");
da.Update(ds, "Customers");
But note that CommandBuilder not come free without price
It has limitations in areas like stored procedure,joins and concurrency handling
So it is good practice to build your Command by yourself
MCAD
|
|
|
|
|
I tried to transfer a Bitmap through a network stream but i couldn't because of a serialization matter .
the compiler told me that you have to serialize the bitmap object. How can i do that ??? or is there any alternative solution???
thanks for help
Don't smile to the world.... It does not smile to you
|
|
|
|
|
Dear all,
How can I check executing a program or opening a file on WinXP in C# ?
What's the related events ?
--TNX
|
|
|
|
|
hi my friend,
for your problem i don't get exactly what do you mean if you are trying to see if one external file is already running or not in your task manager processes list you have to know first the name of the file you would like to trace something like for example "notepad.exe"
if this is the file you want to see if it is already running or not you can do that by checking its name in your task manager processes by its name as follows
<br />
Process[] processes = System.Diagnostics.Process.GetCurrentProcesses();<br />
for(int i = 0 ; i < Processes.Length ; i++)<br />
{<br />
if(processes[i].ProcessName == "notepad")<br />
{<br />
Console.WriteLine("Yeah The File Is already Running");<br />
processes[i].Kill();<br />
}<br />
}<br />
Miss With The Best And Die Like The Rest
|
|
|
|
|
Use Proceess Class it's have method that will do that
you can Enumerate Process and check for specific process
foreach(Process p in Process.GetProcesses())
{
if(p.MainWindowTitle=="phdhdh")
}
To Start File use
Process.Start(fileName);
MCAD
|
|
|
|
|
Any one can help me in the following
i have two functions in "dll.dll" as
int addition(int a,int b);
char* functionname (char* string);
i'm calling this function in C#.NET program using
[DllImport("dll.dll")]
static extern int addition(int a,int b);
how can i declare the character pointer in C# .
Thanks
preky
|
|
|
|
|
|
No can you give some examples.but i tried with unsafe code,how shall i return the character pointer as result.
thanks
preky
|
|
|
|
|
Does
[DllImport("dll.dll")]
IntPtr functionname (char* string);
work? You then would have to do Marshal.PtrToStringAuto to convert the IntPtr into something usable in the managed world.
Hope this helps.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
1>Code:
[DllImport("dll.dll")]
static extern int addition(int a,int b);
static extern IntPtr functionname(char* string);
Error: Pointers may only be used in an unsafe context
To overcome the above error i tried the below code but it shows the following exception.
2>Code:
unsafe static extern IntPtr functionname(char* string);
Exception:
An unhandled exception of type 'System.TypeLoadException' occurred in Unknown Module.
Additional information: Could not load type CallingCdll.Form1 from assembly CallingCdll, Version=1.0.2055.18156, Culture=neutral, PublicKeyToken=null because the method functionname has no RVA.
Thanks
preky
|
|
|
|
|
Oh, I didn't see the second char*, I *think* you can safely replace it with the string class, as in
static extern IntPtr functionname(string str);
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
>>Code:
[DllImport("dll.dll")]
static extern int addition(int a,int b);
static extern IntPtr functionname(string value);
string s="codeprojectiscool";
string output;
int a = addition(3,4);
IntPtr normal;
normal=functionname(s);
output=Marshal.PtrToStringAuto(normal);
MessageBox.Show(a.ToString());
MessageBox.Show(output);
>>Error:
Method, operator, or accessor 'CallingCdll.Form1.functionname(string)' is marked external and has no attributes on it. Consider adding a DllImport attribute to specify the external implementation
>>Exception:
An unhandled exception of type 'System.TypeLoadException' occurred in Unknown Module.
Additional information: Could not load type CallingCdll.Form1 from assembly CallingCdll, Version=1.0.2055.21004, Culture=neutral, PublicKeyToken=null because the method functionname has no RVA.
Thanks
Preky
|
|
|
|
|
You need to attach the DllImport attribute to the second extern function too.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Thanks Mr.Senthil,now it works fine but it doesn't returns the correct output value.
>>Code:
[DllImport("dll.dll")]
static extern int addition(int a,int b);
[DllImport("dll.dll")]
static extern IntPtr functionname(string value);
string s="codeprojectiscool";
string output;
int a = addition(3,4);
IntPtr normal;
normal=functionname(s);
output=Marshal.PtrToStringAuto(normal);
MessageBox.Show(a.ToString());
MessageBox.Show(output);
>>Input:
s="codeprojectiscool" //Initialized at design time itself
>>Output:
normal="123469904"
output="佃䕄剐䩏䍅䥔䍓住L﷽﷽" //error not correct output
but i should get the output="codeprojectiscool"
Thanks
Preky
|
|
|
|
|
hi everybody,
i have a class wich, i try to serialize. in this class i have a string value wich, i want to serialize in a CData section.
Code:
[XmlRootAttribute("result", Namespace="uri:Praxis-edv.de/XML/ResponseSchema.xsd")]<br />
public class GenericResultObject : IGenericResult<br />
{<br />
...<br />
<br />
[XmlAttribute("CommandName", Namespace="uri:Praxis-edv.de/XML/ResponseSchema.xsd", Form = XmlSchemaForm.Qualified)]<br />
public string CommandName<br />
{<br />
...<br />
}<br />
[XmlAttribute("State", Namespace="uri:Praxis-edv.de/XML/ResponseSchema.xsd", Form = XmlSchemaForm.Qualified)]<br />
public GenericResultState State<br />
{<br />
...<br />
}<br />
[XmlAttribute("Type", Namespace="uri:Praxis-edv.de/XML/ResponseSchema.xsd", Form = XmlSchemaForm.Qualified)]<br />
public string TextType<br />
{<br />
...<br />
} <br />
[XmlText(typeof(string))]<br />
public string TextResult<br />
{<br />
...<br />
}<br />
[XmlIgnore]<br />
public System.Type Type<br />
{<br />
...<br />
}<br />
[XmlIgnore]<br />
public object Result<br />
{<br />
...<br />
}<br />
public string ToXml()<br />
{<br />
...<br />
}<br />
public static GenericResultObject GetFromXml(string Xml)<br />
{<br />
...<br />
}<br />
}
Has anybody an idea how i can serialize the value TextResult in a CData section??
thank you.
|
|
|
|
|
Use [XmlCDataSection] attribute instead of XmlText and there you go.
Public Shared Function SerializeObjectToXML(ByVal input As Object, ByVal type As System.Type) As String
Dim returnXML As String = String.Empty
Dim serializer As New XmlSerializer(type)
Dim writer As New StringWriter
Try
serializer.Serialize(New XmlTextWriter(writer), input)
returnXML = writer.ToString()
Catch ex As Exception
Debug.WriteLine(ex.Message)
Finally
writer.Close()
End Try
Return returnXML
End Function
Live Life King Size
Alomgir Miah
|
|
|
|
|
thanks for your answer, but it dosn't work. If i use [XmlCDataSection] i get the errormessage "The type or namespace 'XmlCDataSection' could not be found." I guess i forgot to say, that i programming in C#.
In C# there is no XmlCDataSection object in the 'System.Xml.Serialization' namespace.
Do you have any other idea how i can get this serialized?
|
|
|
|
|
Its under System.Xml
Live Life King Size
Alomgir Miah
|
|
|
|
|
hi
im makming an asp.net web appliucation using c# and sql server 2000 at back end.
when a user completes a registration form of my application, i want to snd him an email ,confirming that he has been registered and his data has been entered into the database.
now can anyone please tell me how to generate email and send it to the email address as entered by the user.
thanx!
|
|
|
|