.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to integrate SQL database and the text output from a C# program

Posted By:      Posted Date: October 22, 2010    Points: 0   Category :Sql Server

Hi, I have been given a project saying that the server has to scan the files in a folder of client system and I should backup the files from the client if there are any new files. I have divided this project into modules:

1) client-server communication

2) filescanning and displaying the latest modified time of the files on console.

and what I intend to do is the list which is shown on the console right now should get embedded into the database so that the server can compare the files and check for the newer ones.

3) finally client sending the files to the server for backup.


I have accomplised till scanning of the files in a folder module. but I am not sure of doing the database part. Is there anyone to help in this kind of project.






View Complete Post

More Related Resource Links

Update Profile Database from text file using BDC



I have a requirement to import the profile properties from a text file in sFTP to update the MOSS Profile Database. The objective is to create a single repository for the Staff Directory in MOSS.

Can I use BDC to connect and update the Profile database?

What is the alternate approach?


how to check the data which i passesd in text box for logine is available in the database or not.

Hi, I created login form in which ---Username, Password & LogOnType is there, When i m passing the correct value i m login successfully. But instead of entering correct value when i m entering wrong values and clicking SignIN its gives the exception. If i m not entering any value in text box and clicking SignIn its ask for values..................................... How i will make the validation which will check the textbox data which i entered there is correct or not. I want error  msg when data not in the database.........................if data in database then successfully logedIn msg.............   please help me ..............................try to give one example with code if possible   Thanku  

Making a program take both standard input and output from/to another program

I have an off-the-shelf program A.exe which reads from standard input and writes to standard output. How do I write a program B.exe that reads from program A and then respond to program A by writing to the standard input (of program A)? Piping (|) seems to be one way only. Thanks.

Why is it that this code updates my sql database with the default EditBox text?

Any help is appreciated. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using MySql.Data.MySqlClient; public partial class _Default : System.Web.UI.Page { TextBox EditBox = new TextBox(); TableRow[] NewRows = { new TableRow(), new TableRow() }; TableCell[] NewCells = { new TableCell(), new TableCell() }; string ID; protected void Page_Init(object sender, EventArgs e) { } protected void Page_Load(object sender, EventArgs e) { var Connection = new MySqlConnection("Server=localhost;Database=site;Username=root;Password=root"); var Command = new MySqlCommand("select * from news", Connection); Connection.Open(); var Reader = Command.ExecuteReader(); while (Reader.Read()) { ID = Reader.GetString("ID"); string Title = Reader.GetString("Title"); string Text = Reader.GetString("Text"); foreach (TableRow Row in NewRows) { NewsTable.Rows.Add(Row); } NewCells[0].Text = Title; NewCells[1].Text = Text; NewCells[0].Font.Bold = true; NewCells[0].Font.Underline = true; NewCells[0].Font.Size = Fon

Output Blank Text File

Hello all,I have come across an interesting edge case when using Response.Write. I couldn't find another forum to post this in, so I'm putting it here, even though its not really "getting started" in my mind.The scenario goes like this:I have a ASPX page that stores data in a string using a comma delimited text format, which is then written to the response stream using Response.Write. Whenever there is data, this works fine. But, when there is no data, the string generated is empty and a basic HTML page structure magically appears in the output even though it isn't even in the .ASPX file. What I'd like to do is simply return a blank text file (not even a space).I've tried using Response.Clear to ensure that there is no content in the response stream. I've tried setting the content type and even specifying a filename in the response header. I am, of course, also using Response.End after the call to Response.Write, but all to no avail. The response is always a basic HTML structure.To eliminate other possibilities, I've set up a test. Just a default .ASPX Web form with the following PageLoad method: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Response.ContentType = "text/plain" Response.Clear() Response.Write("") Response.End() End Sub

Output table from database to excel spreadsheet asp.net c#

Hi All, I'm hoping someone can help me with a small problem. I want to output some data returned from a sql server database and output it out to an excel file. My thinking was to create some excel templates, copy the required one that I want to use and output the data to that. I can pull the data back from the database OK, but have no idea how to write this to the excel spreadsheet. I want to try and keep the code as generic as possible so that I can use it to output a resultset to the correct copied template. Any help or pointers would be greatly appreciated.

Making the program make text boxes according to a num of a variabe

i have a text abox that the user need to enter a number then according to this number the program need to show text boxes

Only show text from database if field is not empty

 Hoping someone can help. I am using ASP.NET VB and i am wondering how to only show text from database if data exists. I tried this but it does not work.Any help would be greatly appreciated.I am new to .NET, in the past i have always used classic asp. 1 <td valign="top" style="border-right: 2px solid #031992"> 2 (<%# Eval("VenderPhone1") %>) <%# Eval("VenderPhone2") %>- <%#Eval("VenderPhone3")%> 3 4 <% If String.IsNullOrEmpty(Trim("VenderAlt1").ToString) Then%> 5 <br />(<%#Eval("VenderAlt1")%>) <%# Eval("VenderAlt2") %>- <%#Eval("VenderAlt3")%> 6 <% End If%> 7 <% If String.IsNullOrEmpty(Trim("VenderFax1").ToString) Then%> 8 <br />(<%# Eval("VenderFax1") %>) <%# Eval("VenderFax2") %>- <%#Eval("VenderFax3")%> 9 <% End If%> 10 11 </td> 12   

Need help with uploading a text file in to mysql database


I want to upload a text file and stored to my database. the column on my database it is longblob type. I don't know much about this so if anyone can help I will thank you. 

CmdLet output displays truncated text, how to get the complete text?



The CmdLet named Get-SPServiceApplication returns the following output in the screen:

DisplayName     TypeName       Id
-----------     --------       --
Security Token Se... Security Token Se... d49acb0f-e8bd-4b6f-a052-f8428db1574b
Application Disco... Application Disco... dc1c88e9-cce1-4dd9-9369-9c5e379895a8
SharePoint Server... SharePoint Server... cc575b26-578f-4fac-b12a-1b2e062b0ea9

The text is truncated and replaced by ellipsis. Is there anyway to get the full text of the content?

Thanks in advance.

Correct Way to Insert Data from Text Boxes on ASPX page into SQL Database Using VB


Please help me, I have been trying this for a week now and this is how far I have gotten.


I am new to this, and I am using MS Visual Web Developer Express.


OK - This is what I have come up with, but when I run it I get the following error  (I decided to just try to use a simplified table just to get an understanding of the basic concepts):



Partial Class label_form
    Inherits System.Web.UI.Page

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        ' Declaring variables
        Dim username, labelname, ownersname, address1, address2, city, state, zipcode, country, contactnumber, emailaddress, data_source, con, sql_insert

        ' Check if Necessary Text Is Missing ( will do this once I can get it to work with no empty text boxes)

        ' Get Values from TextBoxes
        username = txtUserName.Text
        labelname = txtLabelName.Text
        ownersname = txtOwnersName

How to save WPF RichTextBox content (text + image) to the database



I want to save (and after that also to retrieve) the content of an WPF RichTextBox (text + image) to/from the database.

I found this: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/750a654e-b002-4742-8f46-609e93f6ec81 but like the author said, the solution seams not to work for text with image - the image is ignored/removed and only the formatted text is saved and after that retrieved to/from database.

Know someone a solution about this issue?

Best regards,





how to block user written text in combobox while executing the program


'i have written the following code:



Sub Combo_Mth_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)

How to output data from master detail tables into text file but on different lines.



I have a requirement to output data from two tables, a master table and a detail table, to a text file such that the output looks like the following:

master record 1

detail record  1 1

detail record   1 2

master record 2

detail record  2 1

master record 3

detail record 3 1

detail record 3 2

detail record 3 3



Is this possible in one query?  I am sufficiently familiar with the bcp utility to do the output from any of the tables separately but have some difficulty with doing it for the two tables and have the result structured as outlined above.

need html tags to be removed from output text



i have some code written in c# to obtain the text and numbers from a web interface that required user inputs.

my problem is that the texts i am getting off the web is displays in html forms (i.e. it has tags all over the place)

hence, i would like to filter out the html tags, is that possible?

i searched up some codes but it didn't help me as it brought up even more problems when compile.

any helps is greatly appriciated.

import text to database



I have a text file that looks like this:
Chapter 1
Line 1: some text here some text here
Line 2: some text here some text here
Line 3: some text here some text here

Chapter 2
Line 1: some text here some text here
Line 2: some text here some text here
Line 3: some text here some text here

I want to import this into a database so that the table will look something like this:
Chapter, Line, Text
1,1,some text here some text here
1,2,some text here some text here
1,3,some text here some text here
2,1,some text here some text here
2,2,some text here some text here
I guess I need to wrote some custom C#/VB code to get this done, is this correct or can I use SSIS with / without the custome code.


eddiec :-)

Search Text at database level.

How to search text value in the databse schema, it might be used in store procedures, views, tables and as an record within tables or views any where in database.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend