|
How we transfer a table from dbf to sql server 2000 through programming in c# with table schema plz send me at soni_linux@yahoo.co.in
Vinod Soni
|
|
|
|
|
Hi all,
Would like to know how to export the contents of a datagrid to a SQL 2000 db...(with the code as well , if u plz).......
Thx.
-- modified at 6:09 Wednesday 19th April, 2006
|
|
|
|
|
I'm a bit new to Regex, and almost got this working, except for a small glitch. I have a string called entityName which looks like "120 PP (V987) XYZ", from which I have to strip out the entity code which in this case is (V987). The entity code is V or C followed by any number of digits, all of which is enclosed in ().
My code looks like this:
string[] entityNameString;
Regex regex = new Regex(@"^(.*)(\([V,C]\d+\))(.*)");
entityNameString = regex.Split(entityName);
Console.WriteLine(entityName);
foreach(string s in entityNameString)
{
Console.WriteLine("\t" + s + "\t\t" + s.Length);
}
Unfortunately, when I run it, the output produced is
120 PP (C987) ERT
0
120 PP 7
(C987) 6
ERT 4
0
It produces an extra null string at the beginning and the end. I'm guessing my Regex pattern is incomplete. How should I correct this?
Thanks in advance.
Cheers,
Vikram.
I don't know and you don't either.
Militant Agnostic
|
|
|
|
|
That is because you are splitting on pattern that matches the entire string.
Let's go for a simple example: If you have a pattern like "(ell)" and split the string "hello" using that pattern, you will get three strings; "h", "ell" and "o". If you have a pattern like "(hello)" and split the string "hello", you will also get three strings; "", "hello" and "".
Make the pattern match only the "(C987)" part of the string, and you get only three strings in the result.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa, thank you very much!
Cheers,
Vikram.
I don't know and you don't either.
Militant Agnostic
|
|
|
|
|
It really doesn't look like you actually want to be splitting the string at all.
if you try this:-
Regex regex = new Regex(@"^(.*)(\([V,C]\d+\))(.*)");
Match m = regex.Match(entityName);
if (m.IsMatch)
Console.WriteLine( m.Groups[2].Value);
Furthermore, your regular expression could be optimised a little - many of the brackets are unnecessary:-
^.*(\([VC]\d+\)).* should work also. Note the the submatch group number as used in my above code will be 1 for this pattern.
And if you move your submatch brackets a bit, like this,
^.*\(([VC]\d+)\).* then your submatch for the string "120 PP (C987) ERT" will contain "C987". I am of course making a wild assumption here that you don't want the brackets in the output.
Incidentally, I didn't test the above code or patterns, but they're good in substance even if they have minor errors in.
using System.Beer;
|
|
|
|
|
Hello all!
I need to know that can I write rtf text in word document. Actually I have a Richtextbox on my form. Now i need the rtf of that control to be in a word file. Is it possible. If yes............How?
Please help me in this regard
Thanx in Advance
Mubashir
|
|
|
|
|
Hi!
The only way I've found for this so far is to use the clipboard.
Paste your RTF to the clipboard (probably saving the clipboard contents before doing so) and then call Paste on the Selection object you want your RTF to appear in.
Afterwards restore the clipboard contents.
If anyone has a better solution, I'd be interested in that, too.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
My advice would have been to go into "Customize Toolbox" and look for "Microsoft Word" component under the "COM Components tab. But looking there, I see that Word has not been included. Apparently, Microsoft does not want us to have this feature?
Roy.
|
|
|
|
|
Hello,
Right now I am using the following code to open a directory for exploring.
I do believe there must be some one line code available to do the same task. If it is true, then would you please let me know.
The code I am using.
Process openFolder = new Process();
openFolder.StartInfo.FileName = Application.StartupPath + @"\User Files\Email Attachments";
openFolder.StartInfo.CreateNoWindow = false;
openFolder.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
openFolder.StartInfo.UseShellExecute = true;
openFolder.Start();
|
|
|
|
|
I'm not sure exactly what you are wanting to do here...however if all you want to do is enumerate the names of the files inside a directory you just need to do this:
string path = Application.StartupPath+@"file path";
.
.
.
string[] files = System.IO.Directory.GetFiles(path);
foreach ( string file in files )
{
... your code ...
}
|
|
|
|
|
Hi,
thanks a lot for your reply. No, Actually I was looking for a solution to use Windows Explorer to open a directory. I found the soltion as
System.Diagnostics.Process.Start("explorer.exe", "\"C:\\Temp\"");
Thanks again.
|
|
|
|
|
Try this:
System.Diagnostics.Process.Start("explorer.exe", "\"C:\\Temp\"");<br />
this code exploring folder C:\Temp
Best regards, Alexey.
|
|
|
|
|
Thank u very much. Exactly thats the VERY solution i was looking for.
|
|
|
|
|
Hello
In my code I am resizing the image. the following is my code:
public void resizeImage(int width, int height, Bitmap bmp){
System.Drawing.Size imgSize = new Size(width, height);
this.image_bmp = new Bitmap(bmp, imgSize);
}
the image gets distorted or I mean that the picyure quality is not
good.
what other things can we do to get good quality pictures
Deepak Anish
Maxumise Fiji Ltd
Suva, Fiji
|
|
|
|
|
Create a Bitmap with the desired size, create a Graphics object for it and use that to draw the bitmap onto it. Set the SmoothingMode property of the graphics object to SmoothingMode.HighQuality to get the best drawing quality.
If you are enlarging the image, you can't expect a very good result. Even if the image is larger, it doesn't contain more image information than the original image.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I made my Windows C# program with SQL Server 2005 Express. Now when i will ship this software to my client's pc, and if he has SQL Server professional or developer edition, will my Software work or He must install SQL Server Express edition to run my software ?
Thanks
|
|
|
|
|
emran834 wrote: will my Software work or He must install SQL Server Express edition to run my software ?
Your software ought to work and your client should not have to install SQL Server Express. I hope your software works for your client
Paul
|
|
|
|
|
As long as you have externalized your connection string from your program, then you will not have any problems accessing any form of Sql Server.
|
|
|
|
|
Hi guys.Got a fractional function like the form y=(a0*s+a1*s+a2*s)/(b0*s+b1*s+b2*s).I put (a0,a1,a2)in txtNumer and(b0,b1,b2)in txtDenom like in the code below.What I have to write in txtFunction so I get as result in textbox the function.Or Im in a wrong path??Help please...
private void txtNumer_TextChanged(object sender, EventArgs e)
{
string numerator = String.Empty;
if (txtNumer.Text != String.Empty)
{
//put the text of textbox into a string
string source = txtNumer.Text;
//ndaje tekstin ne copat midis presjeve - per ekte na duhet nje array of strings
//se nuk e dime sa numra kemi shtypur ne tekst
string[] pieces = source.Split(',');
int[] numbers = new Int32[pieces.Length];
//we need an array of int or double to get numbers we put in textbox
//so we can convert them
for (int i = 0; i < pieces.Length; i++)
{
numbers[i] = System.Convert.ToInt32(pieces[i]);
}
}
}
private void txtDenom_TextChanged(object sender, EventArgs e)
{
string denominator = String.Empty;
if (txtDenom.Text != String.Empty)
{
//put the text of textbox into a string
string source = txtDenom.Text;
string[] pieces = source.Split(',');
int[] numbers = new Int32[pieces.Length];
///we need an array of int or double to get numbers we put in textbox
//so we can convert them and put them in output textbox
for (int i = 0; i < pieces.Length; i++)
{
numbers[i] = System.Convert.ToInt32(pieces[i]);
}
}
}
private void txtFunction_TextChanged(object sender, EventArgs e)
{
}
}
|
|
|
|
|
Any one used it from C#? Comments.
Also their login/create user accounts is disabled. Any other sources for the sdk? I am just looking at reading the files to make web reports from.
Thanks, Mike
"Every new day begins with possibilities. It's up to us to fill it with things that move us toward progress and peace.” (Ronald Reagan)
|
|
|
|
|
Hi!
I have made an application that connects to a sql server by using the "add data source" method...all the connections have been made with datasets and everything is working.
What i would like to do is to be able to change the connection string, as it is now the connection string is set by c#
(Settings.settings = (Connection string),(Application scope),(Value=Data Source=VM2\SQLEXPRESS....)
however i would like to list all sql servers before login and when user clicks one of the sql servers listed, the connection should be made to this server and then continue with the login.
I have successfulla made a list of the names of the sql servers, but i know too little about how to change the connection settings.
In short, what i want to do is being able to within the program change the Value of the Data Source. I realize this may have to make me create a configuration file, but that is ok.
Can somebody please help me with a codesnippet to run before the connection is made or something?
Greatly appreciated
/nami
|
|
|
|
|
Here is one possible approach:
myapp.exe.config
<br />
<add key="ServerLocation", value=@"...path ..."><br />
here is my code snippet
[Serializable]
public class Servers:List<ServerData>
{}
[Serializable]
public class ServerData
{
string name;
string connection;
public string Name { get; set; }
public string Connection { get; set; }
}
public class myapp
{
...
string location = { depends on framework version as to how you
get your configuration setting }
...
FileStream stream = new FileStream( location, FileMode.Open );
XmlSerializer ser = new XmlSerializer ( typeof( Servers ) );
Servers serverList = ser.Deserialize( stream );
foreach ( ServerData connectionString in serverList )
{
myListBox.Items.Add ( connectionString.Name );
}
That should get you started.
-- modified at 0:15 Wednesday 19th April, 2006
|
|
|
|
|
Hi!
Im currently at work so i cant try that code, but looking at the code i cant really see where it changes the value of the connectionstring already made? this is really the only problem i have with my code so if you could point it out a little better for me it would be greatly appreciated as i'm a newbie
Thank you for your answere!
|
|
|
|
|
Once you have your desired connection string you then create the connection. You do not want to have it hang around long since this is a rare resource. So you just use it, get what you need, and close the connection. You keep the connection global to your application. If a database is changed it is just a matter of creating a new Connection object.
|
|
|
|