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 kumarPosted Feb 28, 2010, 4:51 AM
i am uploading the files here
mark the answer if it helps you
Sam HobbsPosted Mar 1, 2010, 3:07 AM
GustavoPosted Feb 28, 2010, 1:58 PM
??? 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 HobbsPosted Feb 28, 2010, 1:46 PM
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.
GustavoPosted Feb 28, 2010, 6:10 AM
kiran kumarPosted Feb 28, 2010, 6:03 AM
GustavoPosted Feb 28, 2010, 5:45 AM
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 kumarPosted Feb 28, 2010, 5:35 AM
just put the below line in your code
dataGridView1.ColumnHeadersVisible = false;
mark the answer if it helps you
GustavoPosted Feb 28, 2010, 5:33 AM
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 kumarPosted Feb 28, 2010, 5:27 AM
no problem man,i feel very happy to help you
GustavoPosted Feb 28, 2010, 5:21 AM
??? 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 kumarPosted Feb 28, 2010, 5:12 AM
try this line of code
ds.Tables[0].Columns[0].ColumnName ="hello"; //ds refers to dataset object
mark the answer if it helps you
GustavoPosted Feb 28, 2010, 5:11 AM
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";
GustavoPosted Feb 28, 2010, 5:06 AM
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.
kiran kumarPosted Feb 28, 2010, 4:58 AM
GustavoPosted Feb 28, 2010, 4:56 AM
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.
GustavoPosted Feb 28, 2010, 4:47 AM
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.
kiran kumarPosted Feb 28, 2010, 4:37 AM
try like this
string[]words=querystring.split(';');
hope it resolves your problem
mark the answer if it helps you