|
Hello
Ok, Lets imagine we have a Table in sqlServer with these fields:
id (int) , name (nVarChar) , sex (bit)
I show you examples about UPDATE Query with Parameters :
strSQLUpdate = "UPDATE Table SET name=@name,sex=@sex WHERE idu=@idu" ;<br />
cmd = new SqlCommand(strSQLUpdate,Connection) ;<br />
cmd.Parameters.Add ("@id",SqlDbType.Int, 4,"id") ;<br />
cmd.Parameters ["@id"].Value = txtID.Text ;<br />
cmd.Parameters.Add ("@name",SqlDbType.NVarChar, 20,"name") ;<br />
cmd.Parameters ["@name"].Value = txtUsername.Text ;<br />
cmd.Parameters.Add ("@sex",SqlDbType.Bit, 1,"sex") ;<br />
cmd.Parameters ["@sex"].Value = radioButton.Value ;<br />
cmd.ExecuteNonQuery() ;
If you need more codes please alert me and wait 5 hours.
Bye.
|
|
|
|
|
And same sample code using oledb & odbc, please?
Best wishes
|
|
|
|
|
Hi Friends,
I am developing application based on .net Remoting. In my client application i have accessed the remote object by Activator.GetObject function. In this GetObject function, i have passed the second argument as URL, like "tcp://localhost:8384/Container". From my client program how can i validate this URL ? i.e., before using this url i need to identify whether any service is published on this URL or not. Please help me to solve this issue.
Regards,
Prakash.
A Journey of thousand miles must begin with a single step.
|
|
|
|
|
Hi friends,
Am having a grid with a TextBoxColumn which has a combobox...
What eventhandler should be used if ,after selecting the item from the combo,i use the up and down arrow keys to move up and down the rows of the grid.?
Combobox's Leave event is getting fired when i use tab key or mouse alone...
Need urgent help..plz...
Thanx...
|
|
|
|
|
Hi friends,
I tried myself and got the solution....
if anyone needs the solution, ask me.....
![Smile | :)](https://www.codeproject.com/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
I'm having the source code of the web site with streams,response and request.Then i must find the links in sourcecode.i have got a regex that email finds.
string mail=@"(href=)((')|(""))(mailto (?<mail>(.*))((')|(""))";
So i need another regex that about link.How can i learn the regex writing regulation in C# or how can i write linkregex.
i need have only the website url on this code.
|
|
|
|
|
Hi!
If you want to learn how to use RegEx, just search in google. Helpful is one of the regex trainer which let you test your regex search-string before you use it.
But here is an example to catch URLs:
// Clear old data in listboxes
listBox1.Items.Clear();
listBox2.Items.Clear();
// example HTML document
string lsCode = "<HTML><BODY>test1<BR><A HREF='LinkURL1'>Link1</A><BR>test2<BR>" +
"<A HREF='LinkURL2'>Link2</A><BR></BODY></HTML>";
// Regex object to search
System.Text.RegularExpressions.Regex loCheck = null;
// search-string for regex (improtant: ignorecase-option)
loCheck = new System.Text.RegularExpressions.Regex("href=[\"']{0,1}([^\"'> ]*)", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.MatchCollection loLinks = loCheck.Matches(lsCode);
// write every value in the list
foreach (System.Text.RegularExpressions.Match loResult in loLinks)
{
// loResult.Groups[0].Value = "HREF='LinkURL1"
// loResult.Groups[1].Value = "LinkURL1"
listBox1.Items.Add(loResult.Groups[1].Value.ToString());
}
// search-string for regex (improtant: ignorecase-option)
loCheck = new System.Text.RegularExpressions.Regex("[\"']>{0,1}>([^<]*)</A>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.MatchCollection loLinksText = loCheck.Matches(lsCode);
// write every value in the list
foreach (System.Text.RegularExpressions.Match loResult in loLinksText)
{
// loResult.Groups[0].Value = "'>Link1</A>"
// loResult.Groups[1].Value = "Link1"
listBox2.Items.Add(loResult.Groups[1].Value.ToString());
}
In listBox1, all Link addresses will be added. In listBox2, all link text (within <A HREF>???</A>) will be added.
Marcel Erz
|
|
|
|
|
Hallo C# Friends ,
I've a problem and hope for help.
I've created an automation addin for excel with .Net 1.1. It works fine.
Now, the same addin should work with fw 2.0.
I created a new Project with vs2005 (Addin Project). Same settings like the old addin.
I installed the addin and want getting started. But the addin won't start. The Function OnConnect never get started.
Has anybody else the same Problem or can anybody give me help?
Thank for attention
Mario
|
|
|
|
|
hi,
I want to design a report (Crystal report) programmatically but I can't find any document to help me . Please help me.
Thanks for your help
|
|
|
|
|
Dear group:
I have this Marco witch I wanna run it from my C# App.
Sub Macro1()<br />
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then<br />
ActiveWindow.Panes(2).Close<br />
End If<br />
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _<br />
ActivePane.View.Type = wdOutlineView Then<br />
ActiveWindow.ActivePane.View.Type = wdPrintView<br />
End If<br />
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader<br />
Selection.TypeText Text:="<big>a header here</big>"<br />
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocumentEnd Sub
This is what I did but got an error in *oWord.
oWord.ActiveWindow.ActivePane.View.SeekView = Word.WdSeekView.wdSeekCurrentPageHeader;<br />
*oWord.Selection.TypeText text = "<big>a header here</big>";<br />
oWord.ActiveWindow.ActivePane.View.SeekView = Word.WdSeekView.wdSeekMainDocument;
My goal is adding a Header with Dynamic Text.
Tnx in advance.
Always ,
Hovik Melkomian.
|
|
|
|
|
i'm trying to use " in a string variable but can't.
So:
string x=""";
how can i do that?
|
|
|
|
|
\ <-- is the escape char
string myString = "Hello \"World\"";
|
|
|
|
|
Escape the quote using the \ escape character:
string x = "\"";
or use a @-quoted string and double quotes:
string x = @"""";
---
b { font-weight: normal; }
|
|
|
|
|
Hi!
In C# you cannot do that in that way, this is just possible in VB. But you can use excape sequences for that:
string x = "\"";
The Backslash shows the compiler: 'the next charcater is a control character and not an normal character!'.
Her are other Escape-sequences:
\n = new line
\r = carriage return
\t = tab stop
Marcel Erz
|
|
|
|
|
Yes, it's possible in C#. @-quoted strings in C# works just like strings in VB:
string x = @"""";
---
b { font-weight: normal; }
|
|
|
|
|
Hi!
Thx! Didn't know!
Marcel Erz
|
|
|
|
|
i tried that
string x="\"";
if i want show it on screen,it's right.but i want search this in a richtextbox.
then it finds not " alone,it finds with "\".
|
|
|
|
|
Sure! You shoq the compiler with the "\", that it is a special character. So, even in searching, you need to input a "\". Otherwise the compiler will not know if it is a " in a string or a " around a string.
Marcel Erz
|
|
|
|
|
The string x will contain one single character, the quotation mark.
If you have any trouble using it, you have to be using it the wrong way. How do you use it?
---
b { font-weight: normal; }
|
|
|
|
|
try this
char hi= '"';
string say = "hello my name is "+ hi+ "james" + hi;
I hope this helps u
|
|
|
|
|
Hi, I am developing a voice chat application in DirectSound, when I play the voice on the second pc, my voice seem to me a robot voice,I think I play digital voice on the other end, can anyone solve this problem, I will be thankful to u.i am using stream socket to send the captured voice bytes.
|
|
|
|
|
Hi...
how can i play the Audio files in .NET using C# ?
I can select the file to be played but , how can i play it ?
do i have to download any sort of Audio player compatible with .NET ?
Kamran
|
|
|
|
|
You can try using the Windows Media Player control. This[^] is a good place to start from. However, you can always google it[^].
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Hi,
This is srinivas and I have got a rquirement of sending SMS from PC to all Mobile Phones from all over the world. If you have any coding or if you know any websites providing this information plese inform with the website.
Currently the program which we have written is sending SMS for only numbers starting 984..... here we haven't given any query. So please verify it and respond as early as possible.
Thanking you I will be waiting for ur reply.
warmregards
Srinivas
Globalways Solutions.
M.SrinivasRao
|
|
|
|
|
Hi
I use a COM object which needs that I set my Threading-Model to Multi-Threaded-Apartment (MTAThread). If I do not set it to MTAThread I get System.InteropServices.COMException when I call COM-Functions.
If I set it to MTAThread I get a 'System.InvalidOperationException:DragDrop registration failed' exception when opening a Windows-Form element with AllowDrop set to true.
Is it not possible to enable DragDrop in a Multi-Threaded-Apartment?
Thanks
Martin
|
|
|
|