Hello:
I have a long line that has a string in it. How can I wrap the line to multiple lines? The line I have is below. I tried the '_' but it will not take it for the string.
string querystring = "Driver={Microsoft Text Driver (*.txt; *.csv)};defaultdir=C:\\IceCorp;driverid=27;fil=text;filedsn=C:\\IceCorp\\IP_Login.csv;maxbuffersize=2048;maxscanrows=8;pagetimeout=5;safetransactions=0;threads=3;uid=admin;usercommitsync=Yes";
Loading

kiran kumarRank #3,110 · 461 reputationPosted Feb 27, 2010, 11:51 PM EST
i am uploading the files here
mark the answer if it helps you
kiran kumarRank #3,110 · 461 reputationPosted Feb 27, 2010, 11:37 PM EST
try like this
string[]words=querystring.split(';');
hope it resolves your problem
mark the answer if it helps you
GustavoRank #1,990 · 732 reputationPosted Feb 27, 2010, 11:47 PM EST
I dont understand? I typed 'querystring.split' the help does not see any. I tried Splitter and SplitContainer... it does not work. I am probably doing something wrong.
GustavoRank #1,990 · 732 reputationPosted Feb 27, 2010, 11:56 PM EST
Sorry... I ment in the code. So it does not go past the window.
But this is a good sample. I can use it later.
kiran kumarRank #3,110 · 461 reputationPosted Feb 27, 2010, 11:58 PM EST
GustavoRank #1,990 · 732 reputationPosted Feb 28, 2010, 12:06 AM EST
BTW: In the dataGrid issue. I already have the hearder defined in the program. Is there a way when it loads the data, suppress the hearder that are in the file. Seems its appends the data and hearder as columns.
GustavoRank #1,990 · 732 reputationPosted Feb 28, 2010, 12:11 AM EST
I figured it out. I was hoping to use the '_' to continue the line but I guess it does not work for a string. So I did this:
string querystring = "Driver={Microsoft Text Driver (*.txt; *.csv)};"
+ "defaultdir=C:\\IceCorp;"
+ "driverid=27;"
+ "fil=text;filedsn=C:\\IceCorp\\IP_Login.csv;"
+ "maxbuffersize=2048;maxscanrows=8;"
+ "pagetimeout=5;"
+ "safetransactions=0;"
+ "threads=3;"
+ "uid=admin;"
+ "usercommitsync=Yes";
kiran kumarRank #3,110 · 461 reputationPosted Feb 28, 2010, 12:12 AM EST
try this line of code
ds.Tables[0].Columns[0].ColumnName ="hello"; //ds refers to dataset object
mark the answer if it helps you
GustavoRank #1,990 · 732 reputationPosted Feb 28, 2010, 12:21 AM EST
??? That would set the colum name to "hello", correct?
What I wanted, is when the code below, loads the data it automatically loads the 1t like as the column name. I would like it to supress the loading of the column names. Maybe I am asking too much?
Is there a Heder suppress option?
string querystring = "Driver={Microsoft Text Driver (*.txt; *.csv)};"
+ "defaultdir=C:\\IceCorp;"
+ "driverid=27;"
+ "fil=text;"
+ "filedsn=C:\\IceCorp\\IP_Login.csv;"
+ "maxbuffersize=2048;maxscanrows=8;"
+ "pagetimeout=5;"
+ "safetransactions=0;"
+ "threads=3;"
+ "uid=admin;"
+ "usercommitsync=Yes";
OdbcConnection con = new OdbcConnection(querystring);
OdbcDataAdapter da = new OdbcDataAdapter("select * from IP_Login.csv", con);
DataTable dt = new DataTable();
da.Fill(dt);
kiran kumarRank #3,110 · 461 reputationPosted Feb 28, 2010, 12:27 AM EST
no problem man,i feel very happy to help you
GustavoRank #1,990 · 732 reputationPosted Feb 28, 2010, 12:33 AM EST
I do want column names, but I already set them up in the program by using 'Edit Columns' on the grid. Because I use the 'column names' to find stuff.
I just want the data loading to start with column 1. It seems because the grid already has defined column names, it adds the new column names at the end, so my data starts at like comlumn 8.
LOL... Did I confuse it more?
kiran kumarRank #3,110 · 461 reputationPosted Feb 28, 2010, 12:35 AM EST
just put the below line in your code
dataGridView1.ColumnHeadersVisible = false;
mark the answer if it helps you
GustavoRank #1,990 · 732 reputationPosted Feb 28, 2010, 12:45 AM EST
The dataGridView1.ColumnHeadersVisible = false; is not what I am looking for.
I read some stuff like to set: "HDR=No". But I cant get it to work. I just want the first column in the file to load into the first colum of the grid.
kiran kumarRank #3,110 · 461 reputationPosted Feb 28, 2010, 1:03 AM EST
GustavoRank #1,990 · 732 reputationPosted Feb 28, 2010, 1:10 AM EST
Sam HobbsRank #107 · 20.5K reputationPosted Feb 28, 2010, 8:46 AM EST
You can put long strings into the Settings for the program. Do you know how to do that? In the solutions explorer, expand the Properties node and then open the Settings.Settings node. You should see a grid with columnss for name, type, scope and value. You can put strings in there. For strings that are not changed by the user, the scope should be application. Then in your program, use something such as the following to get the string:
The reason why "_" does not work is because that is VB syntax; it is not recognized by other languages.
GustavoRank #1,990 · 732 reputationPosted Feb 28, 2010, 8:58 AM EST
??? I did check "Do you like this Answer" for this post. It does not show? I knwo I have one other post that I have not really gotten an good answer.
Now I have to figure out how to set the" Properties.Settings.Default.ConnectionString".
Thanks
Sam HobbsRank #107 · 20.5K reputationPosted Feb 28, 2010, 10:07 PM EST