Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have files (like plain text) that I should insert into SQL using C#.
They are headerless, and even without extension. Only info I have is starting index of every column.
Any help how can I do this? Ok, I know I will need to separate columns and insert them in datatable when I read file, but how to read those rows?
You need to read up on SQL Server's bcp.exe utility (bulk copy) and its SQL statement brother bulk insert and their C# sister, SqlBulkCopy.
As far as creating a custom DataTable goes, read the documentation. Don't forget to invoke AcceptChanges() after creating the columns you want, and after adding the data you want to add.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to update daily sales & stock details to my head quarter database every EOD, which was located in different server. How can I achieve it by any latest & efficient technique? My application is a .NET 4.0 web application.
Note: existing technique we follow is manual download/upload concept, hitting HQ database and inserting the data and fetching data from HQ database.
Please advice..
link another server like this
EXEC sp_addlinkedserver
#server=N'S1',
#srvproduct=N'',
#provider=N'SQLNCLI',
#datasrc=N'192.168.0.1\SQLEXPRESS';
then you can use tables from this server like
SELECT * FROM S1.Data_1314.dbo.dev_vr_Details;
INSERT INTO dev_vr_Details SELECT * FROM S1.Data_1314.dbo.dev_vr_Details;
when you finish your work just remove like like
sp_dropserver 'S1', 'droplogins';
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I would like to read in a .cs file from my project which contains a code sample for use by clients of my company's API.
What's the best way to read in this file and pretty-print it to the page with indentations etc. The goal is to just have the code on the page automatically change when I update the contents of this file so that the code sample will always be up to date as published on the live site.
An example of what I'm attempting to accomplish is something similar to this: http://msdn.microsoft.com/en-us/library/vstudio/ezwyzy7b.aspx
I'd use this...
http://www.manoli.net/csharpformat/
http://www.manoli.net/csharpformat/CSharpFormat.zip
It transforms C# code into html. You can read the file run it through the CSharpFormat then output the HTML to a panel in the page.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am new with ASP Dot Net. I am looking for some Data Component for following scenario.
User double click on the cell and add some text.
Text should automatically save in database.
I have tried with GridView but its not working. I am getting GridView columns from MSSQL Server Table which are around 600. As mentioned above what I want to do is when a user clicks on a cell it should let the user to add text and then save in database.
Please let me know how to proceed or Should I need to use some other Data Component.
Are you using an SQL data source or back-end code? You can check out using a template column for your editable fields so you can run your update on a change event. Here is some info on template columns :
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.templatefield.edititemtemplate%28v=vs.100%29.aspx
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a requirement to compare a "key" of each records(around 1m records) against 70m+ records in DB.
I really don't want to hit the DB again and again to compare.
when I try to load all the keys (just keys) from DB to in memory (hashTable), I am getting out of memory exceptions randomly on other parts of program (as I expected).
is there any file based implementation of hash table instead of in-memory?
Create a temporary table in the DB and write all the 1m keys to it. Then, use a query to compare the keys in the temp table with the ones in the target table - this will be relatively fast since SQL engines are really good at joining. Since you only need results for 1m keys, the query will return 1m rows(instead of 70m), and you can also stream that result(since it already contains the matches).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to write an employee maintenance program (in C#) that can add, change and delete from a text file. I have the HTML all put into an .aspx file but I have NO clue on how to set it up to read from a text file and populate the input fields with the employee to maintain.
If I could get some insight on how to read a text file and populate the input fields(form fields) that would be great. Even a link that explains it since I haven't been able to find one. The text file will have to have a record ID as the first field so I know which one to grab for editing(to display) or deleting.
There's a toolkit of functions to manipulate files in the system.io.file class. That's a reasonable start for the project.
You might also consider using a database instead of a text file. They're designed to handle storage and retrieval of data that changes a lot. A text file is doing it the hard way.