|
Anyway Thank you for your help ...
Assaf
|
|
|
|
|
There is no one particular right way to do this. Like PIEBALD said, you'll have to create your own. Shouldn't be the tough. You'll need to have a way to store locally on the client machine the different connections, and other pertinent information needed for the connections.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I can do my own
But i want to call the one is called by the wizard where i choose the server and the database
and i can retreive then the name of each
My question can i do this by code ???
Thank you in advance
Assaf
|
|
|
|
|
Assaf82 wrote: i want to call the one is called by the wizard
Not sure if you can. It might be easier just to do your own
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
If it's even possible, the user would need to have Visual Studio installed to use your program.
---
single minded; short sighted; long gone;
|
|
|
|
|
Or will something like this help?
System.IO.FileInfo f = new System.IO.FileInfo ( "\\xt.udl" ) ;
f.OpenWrite().Close() ;
System.Diagnostics.Process p = System.Diagnostics.Process.Start ( "\\xt.udl" ) ;
p.WaitForExit() ;
System.Console.Write ( f.OpenText().ReadToEnd() ) ;
|
|
|
|
|
hi
How does one populate a grid with an array of objects?
this is the code for populatin a dropdown list control.
Author[] authorArray = dbComponent.GetAuthors();<br />
<br />
foreach (Author a in authorArray)<br />
{<br />
ListItem item = new ListItem();<br />
item.Text = a.FirstName + " " + a.LastName;<br />
item.Value = a.AuthorID;<br />
ddlAuthor.Items.Add(item);<br />
}
but i want to populate a grid control...
could anyone please help.
Thanks
|
|
|
|
|
Does this[^] article help?
/ravi
|
|
|
|
|
Yes, that is possible. Use the FileStream class to open the file, and use the Position property do decide where to read.
You will be reading bytes, of course, not characters.
---
single minded; short sighted; long gone;
|
|
|
|
|
I don't understand this, when I serialized my original index as 26 seperate hashtables, the index was only 1gig.
But just doing test runs with BinaryWriting and I shooting over 10gig easily on the same data.
Am I missing something here?
|
|
|
|
|
How are you serialising the data?
---
single minded; short sighted; long gone;
|
|
|
|
|
I had a busy form of which I had to copy, any idea why do I get this error..
Error 1 The item "obj\Debug\MySolutionFolder.My_Busy_Form.resources" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter.
please help
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
On this link.
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
i need to dir all languages that in pc control panel in combobox to choose from it
i need quick answer
plz
thanks
md_refay
|
|
|
|
|
hi there,
i m reading a binary but it takes so long time to read, here is the codes
FileStream fs = new FileStream(@"D:\art1.bar", FileMode.Open);
BinaryReader br = new BinaryReader(fs);
string chk = "";
for (int a = 0; a < 4; a++)
{
chk += br.ReadChar().ToString();
}
int version = br.ReadInt32();
int unknown = br.ReadInt32();
byte[] uselessbytes = br.ReadBytes(264);
int unknown1 = br.ReadInt32();
int tnums = br.ReadInt32();
long dir = br.ReadInt64();
byte[] byts = br.ReadBytes(tnums);
br.BaseStream.Position = dir;
int dirnamelength = br.ReadInt32();
dirnamelength *= 2;
string dirname = "";
for (int a = 0; a < dirnamelength; a++)
{
dirname += br.ReadChar().ToString();
}
dirname = dirname.Replace("\0", "");
dirname = dirname.Replace("\\", "");
dirname = dirname.Replace(" ", "");
int numofFilesindir = br.ReadInt32();
for (int a = 0; a < numofFilesindir; a++)
{
dataGridView1.Rows.Add();
dataGridView1[1, a].Value = br.ReadInt32();
dataGridView1[2, a].Value = br.ReadInt32();
br.BaseStream.Position += 20;
int filelength = br.ReadInt32();
filelength *= 2;
string filename = "";
for (int b = 0; b < filelength; b++)
{
filename += br.ReadChar();
}
filename = filename.Replace("\0", "");
filename = filename.Trim();
filename.Remove(filename.Length - 3);
dataGridView1[0, a].Value = filename;
}
br.Close();
fs.Close();
it taking 15 seconds to read about 7000 files(i.e numofFilesindir = 7000)
i wanna know how can i reduce time or any alternative way that read fast
Becoming Programmer...
|
|
|
|
|
One reason is that you are concatening strings, this can become horribly slow inside loops, since each time a new string instance has to be created.
Use a StringBuilder instead and replace += with its Append method.
Also, you're reading the file byte by byte, why don't you read in all bytes at once an then convert the byte array to a string using the Encoding class?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
ok i ll use string builder, and tell you the result
Greeeg wrote: Also, you're reading the file byte by byte, why don't you read in all bytes at once an then convert the byte array to a string using the Encoding class
i cannot read in my format, its a file format of a game, thats why i have to read like that
Becoming Programmer...
|
|
|
|
|
xmen_xwk wrote: i cannot read in my format, its a file format of a game, thats why i have to read like that
7,000 files for a game?? A little excessive, don't you think?
|
|
|
|
|
its a archive file where about 7000 files stored, and there are about 8 or 9 more files like that have lots of files stored
i think you never edit any game...
Greeeg Use a StringBuilder instead and replace += with its Append method.
i tried it too but no benefit
-- modified at 13:29 Sunday 16th September, 2007
Becoming Programmer...
|
|
|
|
|
xmen_xwk wrote: filename += br.ReadChar();
That's equivalent to:
object temp1 = (object)br.ReadChar();
string temp2 = fileName.ToString() + temp1.ToString();
fileName = temp2;
That means that you create three new objects for every single character that you read. If the filenames are 20 characters by average, that comes to 420000 objects for reading 7000 files.
Use the ReadChars method to read several characters from the stream.
xmen_xwk wrote: filename.Remove(filename.Length - 3);
That doesn't accomplish anything. The Remove method returns the new string, so you have to take care of the return value, just as you do with the Replace and Trim methods.
---
single minded; short sighted; long gone;
|
|
|
|
|
Guffa wrote: That doesn't accomplish anything. The Remove method returns the new string, so you have to take care of the return value, just as you do with the Replace and Trim methods.
but if i use replace then it replace all the "//" from string , i just want to remove this from last of string, not in all
Guffa wrote: Use the ReadChars method to read several characters from the stream
yeah i used that but its just return "System.Char[]" something like that
Becoming Programmer...
|
|
|
|
|
xmen_xwk wrote: i just want to remove this from last of string, not in all
That's just it. Your calling the Remove method, but completely ignoring the return from it. You can reomve the line completely from your code and nothing changes. It has to be:
filename = filename.Remove(something...);
|
|
|
|
|
xmen_xwk wrote: but if i use replace then it replace all the "//" from string , i just want to remove this from last of string, not in all
There's nothing wrong in using the Remove method, but you are using it wrong. Read what I wrote again, and see if you understand it.
xmen_xwk wrote: yeah i used that but its just return "System.Char[]" something like that
Then you don't use it correctly. It sounds like you are trying to use the ToString method on the array to get it as a string, but that will only get the type of the array. Use the string constructor that takes a char array.
---
single minded; short sighted; long gone;
|
|
|
|
|
ok i did some changes
1.
string filename = new string(br.ReadChars(filelength));
2.remove the line that was removing last 3 characters
but it still taking 12 secs, its too much for me, any other changes that reduce the time???
here is the changed coding
FileStream fs = new FileStream(@"D:\art2.bar", FileMode.Open);
BinaryReader br = new BinaryReader(fs);
string chk = new string(br.ReadChars(4));
int version = br.ReadInt32();
int unknown = br.ReadInt32();
byte[] uselessbytes = br.ReadBytes(264);
int unknown1 = br.ReadInt32();
int tnums = br.ReadInt32();
long dir = br.ReadInt64();
byte[] byts = br.ReadBytes(tnums);
br.BaseStream.Position = dir;
int dirnamelength = br.ReadInt32();
dirnamelength *= 2;
string dirname = new string(br.ReadChars(dirnamelength));
dirname = dirname.Replace("\0", "");
dirname = dirname.Replace("\\", "");
dirname = dirname.Replace(" ", "");
int numofFilesindir = br.ReadInt32();
for (int a = 0; a < numofFilesindir; a++)
{
dataGridView1.Rows.Add();
dataGridView1[1, a].Value = br.ReadInt32();
dataGridView1[2, a].Value = br.ReadInt32();
br.BaseStream.Position += 20;
dataGridView1[3, a].Value ="";
int filelength = br.ReadInt32();
filelength *= 2;
string filename = new string(br.ReadChars(filelength));
filename = filename.Replace("\0", "");
filename = filename.Trim();
dataGridView1[0, a].Value = filename;
}
br.Close();
fs.Close();
Becoming Programmer...
|
|
|
|
|
The DataGridView is probably the bottleneck now, I tried a basic example of adding 10000 rows, it was slow adding them in a loop like your example but when I added them using Rows.AddRange() it was much quicker.
DataGridViewRow[] rows = new DataGridViewRow[10000];
for (int i = 0; i < 10000; i++)
{
rows[i] = new DataGridViewRow();
DataGridViewCell cell1 = new DataGridViewTextBoxCell();
DataGridViewCell cell2 = new DataGridViewTextBoxCell();
DataGridViewCell cell3 = new DataGridViewTextBoxCell();
cell1.Value = i;
cell2.Value = i * 10;
cell3.Value = i * 100;
rows[i].Cells.AddRange(cell1, cell2, cell3);
}
dataGridView1.Rows.AddRange(rows);
You may want to look into the the virtual mode and/or the data sources that can be used with the DataGridView.
|
|
|
|