When i'm trying to create microsoft text driver(.txt , .csv) pointing to some specified .csv file,it don't show the file in Select directory? - odbc

Actually my intension is talking with non-conventional database like ms=excel,txt files. When i'm trying to create microsoft text driver in data source pointing to some .csv file and also trying to some file in my drives.. in that select Directory file is not visible to pointing it is in hidden mode What is the problem.

You must point to the directory in ODBC first, then set the options for the defined column header format. The ODBC connection will recognize all text files in the directory, and follow the header formats for the columns you must specify

Related

How to load source file without header in IICS

I want to load flat file which is ~ delimited but doesn't any header into Snowflake table using informatica cloud integration service.
Just wanted to know how to add header to source file or any turn around in order to map fields in fields mapping option in target .Please find below screenshot. Not able to figure it out which field in source will be mapped in target table as source file does not have headers.

Ms access 2010 how to open MSpaint with a blank page using the form name as a file name?

I made a program to create Jobs field Tickets, and i want to add a option in the same form that open MSPaint or other program in a blank page using the ticket number as a file name, so, whoever is creating the Ticket can hand draw anything.
Create an empty template image file with appropriate dimensions and file type at a constant path
use FileCopy to copy it to your desired path & file name
use Shell to launch a mspaint.exe command-line with your file name as parameter.

How to read invariant csv files using c#

I am working on Windows Application development using c#. I want to read a csv file from a directory and imported into sql server database table. I am successfully read and import the csv file data into database table if the file content is uniform. But I am unable to insert the file data with invariant form ex.Actually my csv file delimiter is tab('\t') and after getting individual fields I have a field that contains data like dcc
Name
----
xxx
xxx yyy
xx yy zz
and i rerieved data like xxx,yyy and xx,yy,zz so the insertion becomes problem.
How could i insert the data uniformly into a database table.
It's pretty easy.
Just read file line-by-line. Example on MSDN here:
How to: Read Text from a File
For each line use String.Split Method with your tab as delimiter. Method documentation and sample are here:
String.Split Method (Char[], StringSplitOptions)
Then working insert your data.
If a CSV (or TSV) value contains a delimiter inside of it, then it should be surrounded by quotes. See the spec for more details: https://www.rfc-editor.org/rfc/rfc4180#page-3
So your input file is incorrectly formatted. If you can convince the input provider to fix this issue, that will be the best way to fix the problem. If not, other solutions may include:
visually inspecting and editing the file to fix errors, or
writing your parser program to have enough knowledge of your data expectations that it can correctly "guess" where the real delimiters are.
If I'm understanding you correctly, the problem is that your code is splitting on spaces instead of on tabs. Given you have read in the lines from the file, all you need to do is:
string[] fileLines;//from the file
foreach(string line in fileLines)
{
string[] lineParts=line.Split(new char[]{'\t'});
}
and then do whatever you want with each lineParts. The \t is the tab character.
If you're also asking about writing the lines to a database file...you can just read in tab-delimited files with the Import Export Wizard (assuming you're using Sql Server Mgmt Studio, but I'm sure there are comparable ways to import using other db management software).

Code to upload an excel file and read it in a dataset

I have a requirement , where in I have to upload an .xlsx file on the server and then read the file into a data table using c# , asp.net.
I need to get your file onto the server.
I need to open the (uploaded?) file.
I need to read the contents of the file, applying any nessesary data parsing.
I need to display the results in a gridview.
Help would be appreciated.

Getting extension of the file in FileUpload Control

At the moment i get file extension of the file like :
string fileExt = System.IO.Path.GetExtension(filUpload.FileName);
But if the user change the file extension of the file ( for example user could rename "test.txt" to "test.jpg" ), I can't get the real extension . What's the solution ?
You seem to be asking if you can identify file-type from its content.
Most solutions will indeed attempt the file extension, but there are too many different possible file types to be reliably identifiable.
Most approaches use the first several bytes of the file to determine what they are.
Here is one list, here another.
If you are only worried about text vs binary, see this SO question and answers.
See this SO answer for checking if a file is a JPG - this approach can be extended to use other file headers as in the first two links in this answer.
Whatever the user renames the file extension to, that is the real file extension.
You should never depend on the file extension to tell you what's in the file, since it can be renamed.
See "how can we check file types before uploading them in asp.net?"
There's no way to get the 'real' file extension - the file extension that you get from the filename is the real one. If file content is your concern, you can retrieve the content type using the .ContentType property and verify that it is a content type that you are expecting - eg. image/jpg.

Resources