|
hi
i want to ignore some characters in serach within strings, for example, when user typed 'water' and click search,at the result, plus 'water', some words like 'wâter' or 'wãter' also find.
thanks
|
|
|
|
|
Regex regex = new Regex("w(a|â|ã)ter");
bool regularAMatches = regex.IsMatch("water");
bool funnyAMatches = regex.IsMatch("wãter");
bool iMatches = regex.IsMatch("witer");
|
|
|
|
|
I am having a small problem whle inserting my data into a database through a stored procedure in sql.
The table schema is as follow: C_Name, C_Capital,C_Currency,C_President
The problem is that when enter data through a stored procedure only the first lettter of each value is stored in each column.
e.g(if i enter "Australia","Canberra","Dollar","John Howard")only (A,C,D,J)
get stored in their respective columns why is this happening can anybody help me out.
The Code is given below:
SqlCommand cmd= new SqlCommand("sp_insert",conn);
cmd.CommandType=CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@cname",SqlDbType.NChar,50,"C_Name"));
cmd.Parameters.Add(new SqlParameter("@ccapital",SqlDbType.NChar,50,"C_Capital"));
cmd.Parameters.Add(new SqlParameter("@ccurrency",SqlDbType.NChar,50,"C_Currency"));
cmd.Parameters.Add(new SqlParameter("@cpresident",SqlDbType.NChar,50,"C_President"));
cmd.Parameters[0].Value="Australia";
cmd.Parameters[1].Value="Canberra";
cmd.Parameters[2].Value="Australian Dollar";
cmd.Parameters[3].Value="John Howard";
int i=cmd.ExecuteNonQuery();
Console.WriteLine(i);
The Code of the stored procedure is:
create procedure sp_insert @cname nchar,@ccapital nchar,@ccurrency nchar
,@cpresident nchar
as insert into country values(@cname,@ccapital,@ccurrency,@cpresident)
plz..help.It's Urgent....
|
|
|
|
|
In the country table, what are the datatypes for cname, ccapital, and ccurrency? Are they nchar(1)?
|
|
|
|
|
No they are not nchar(1), its nvarchar(50)....can u figure out a solution to this
|
|
|
|
|
Try:
create procedure sp_insert @cname nchar(50),@ccapital nchar(50),@ccurrency nchar(50),@cpresident nchar(50)
Read this:nchar and nvarchar (Transact-SQL) [^]
Regarding nchar [ ( n ) ] it states when n is not specified in a data definition or variable declaration statement, the default length is 1.
topcoderjax - Remember, Google is your friend.
|
|
|
|
|
Thanx a lot it worked.....now how can i create a procedure that returns a row how can i read it in .net
|
|
|
|
|
I want to serialize program settings to a binary file. The problem is that the settings are written to a binary file but I cannot retrieve them into a propertygrid control. Here is the code.
<code>
namespace OpsTest
{
[Serializable()]
public class ProgramSettings
{
private Font _editorFont;
private Color _editorTextColor;
[Category("Editor Settings"),
Description("The font used by the editor.")]
public Font EditorFont
{
get { return _editorFont; }
set { _editorFont = value; }
}
[Category("Editor Settings"),
Description("The text color used by the editor.")]
public Color EditorTextColor
{
get { return _editorTextColor; }
set { _editorTextColor = value; }
}
}
}
public partial class OptionsDialog : Form
{
ProgramSettings mySettings = new ProgramSettings();
public OptionsDialog()
{
InitializeComponent();
}
private void OptionsDialog_Load(object sender, EventArgs e)
{
optionsPropertyGrid.SelectedObject = mySettings;
SerializeLoad();
}
public void SerializeLoad()
{
string sFilename = Path.GetDirectoryName(Application.ExecutablePath) + @"\settings.dat";
if (File.Exists(sFilename))
{
Stream inStream = File.Open(sFilename, FileMode.Open);
BinaryFormatter bf = new BinaryFormatter();
mySettings = (ProgramSettings)bf.Deserialize(inStream);
inStream.Close();
}
}
public void SerializeStore()
{
string sFilename = Path.GetDirectoryName(Application.ExecutablePath) + @"\settings.dat";
Stream outStream = File.Open(sFilename, FileMode.Create);
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(outStream, mySettings);
outStream.Close();
}
private void okButton_Click(object sender, EventArgs e)
{
SerializeStore();
this.Close();
}
</code> The categories are there but no values appear in the propertygrid!
Thanks,
Mark
-- modified at 9:50 Friday 25th May, 2007
|
|
|
|
|
hi
change the two lines in the OptionsDialog_Load event.
you must load/deserialize the object and then set it to the propertygrid
selectedobject property.
regards
|
|
|
|
|
Hi,
There are two mistakes I can see:
1) You should set the 'mySettings" to "optionsPropertyGrid.SelectedObject" after loading. So the codeshould be :
SerializeLoad();
optionsPropertyGrid.SelectedObject = mySettings;
2) In function "SerializeStore" you should first copy the value of "optionsPropertyGrid.SelectedObject" to "mySettings" before serializing it.
That means you should add the below line in the function "SerializeStore".
mySettings = (ProgramSettings)optionsPropertyGrid.SelectedObject
Manoj
Never Gives up
|
|
|
|
|
|
I am writing an application for editing various different documents. I have a base form that handles the basic document actions, such as placing the name of the document in the title bar, having a Save menu item, etc - basically this form interacts with my base Document class.
To handle each of the derived Document classes, I am creating a form derived from the base form, and adding document specific actions (at this point, it's mostly dropping the editor control for the specific document on to the form and providing a constructor with the derived document class rather than the general document class).
I've got to the stage where I have implemented a MenuStrip on the base form that has the Save/Save As functionality for the document as ToolStripMenuItems, and this form handles merging with the MDI Parent menu. I have provided a "Document" menu as well which is blank, that is designed for deriving forms to add document specific commands to.
What I would like to do is have the designer be able to show the MenuStrip from the base class when designing the derived class, so that I can use the designer to implement the derived form's menu items.
I've got as far as altering the modifier of the MenuStrip and "Document" ToolStripMenuItem to be protected so that I can at least access them from code in the derived form. This lets me programmatically add my items to the Document menu, but doesn't let me do anything in the Designer.
I know the designer has issues with inherited forms, having struggled to get as much from the designer as I have managed to, but does anyone know of anyway to get inherited items like MenuStrips showing up in the designer?
As I say, I'm able to add them programmatically, but it would be nice to be able to use the Designer if there is an easy way to get it working. Any help / links to info appreciated. Thanks!
|
|
|
|
|
Hi
I'm using webdav method to fetch mails from exchange server and same as send mails. My problem is - if in the mail in exchange server is in spanish langugae how to identify that mail is spanish mail.
Which property is used to identify mail language.
Any suggestions please.
Regards
Arunkumar Sundaravelu
|
|
|
|
|
I don't think you can recover the language, but you should be able to get to the character encoding.
|
|
|
|
|
thanks Boyd for kind your response.
Did you know which mapi property to identify the character set encoding
Thanks
Arunkumar Sundaravelu
|
|
|
|
|
YourMessage.BodyEncoding = System.Text.Encoding.ASCII;
Make sure you do it before sending, "I'm using Latin letters here".
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi Muammar
thanks for your response.
The property as you mentioned is "BodyEncoding".
which was not found in webdav method, how can i fetch the value of the BodyEncoding Property.
I use the below coding using search method of webdav.
Please suggest me.
///////////////////<
string strXML;
string strInboxURL = "http" + "://" + strServerName + "/exchange/" + strUserName + "/" + strFolderName;
MSXML2.XMLHTTP objXMLHTTP = new MSXML2.XMLHTTP();
System.Xml.XmlDataDocument xmlDOMParams = new System.Xml.XmlDataDocument();
objXMLHTTP.open("SEARCH", strInboxURL, false, strAliasName,strPassword);
objXMLHTTP.setRequestHeader("Content-type", "text/xml");
objXMLHTTP.setRequestHeader("Depth", "1");
strXML = "" +
" = \'DAV:\'>" +
"" +
"SELECT \"urn:schemas:httpmail:fromemail\"," +
"\"urn:schemas:mailheader:cc\"," + //
"\"urn:schemas:httpmail:displayto\"," +
"\"urn:schemas:mailheader:thread-topic\"," +
"\"urn:schemas:httpmail:to\"," +
"\"DAV:displayname\"" +
" FROM scope(\'shallow traversal of " + "\"" + strInboxURL + "\"\')" +
" WHERE \"DAV:ishidden\"=" + "false" +
" AND \"urn:schemas:httpmail:read\"=" + "false" +
" AND \"DAV:isfolder\"=" + "false"+
"" +
"";
objXMLHTTP.send(strXML);
xmlDOMParams.LoadXml(objXMLHTTP.responseText);
xmlDOMParams.Save("D:\\Test.xml");
///////////////////////
|
|
|
|
|
how to retrieve logon hours of a user in active directory using C#
iam getting output but it returns 21 Dimension array what it really mean?
|
|
|
|
|
i have a simulation project.i want to use wpf window just showing simulation.i want to put textboxes,buttons and serialport into Form1.cs.when i get serial data with form1.cs than i ll call simulation window(wpf form).i have already done it just wpf window(wpf project).if i add new form1.cs .can i control simulation?
1)i have done this project just window1.
2)i want to add form.cs in order to use serial port properties easier than window1.
Master will be form1.cs
slave will be window1.
|
|
|
|
|
This[^] should help you out
Don't be overcome by evil, but overcome evil with good
|
|
|
|
|
An assignment given to me is to develop a plug In for Microsoft word/Adobe Photoshop.
I dont know that how to start with this.
I want to know how to write a plug In in .Net.
Please reply soon
Thnx
|
|
|
|
|
hi
the link to a sample
http://www.codeproject.com/csharp/c__plugin_architecture.asp
regards
|
|
|
|
|
|
Hi,
I am developing application in which an Arraylist has a list of users. I also have a TreeView to show the users in the list.
Can anyone tell me how to bind the TreeView Control to the Arraylist?
Thanks in advance,
Murali
|
|
|
|
|
Murali,
If you want to use a tree view then one way i can suggest is that, you
you populte the tree view like below:
Suppose "tvw" is the tree view.
TreeNode ndRoot = new TreeNode(stringUserName);
tvw.Nodes.Add(ndRoot);
this way you can add all ur users in the tree view.
Manoj
Manoj
Never Gives up
|
|
|
|
|