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

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

Adding a SQL Server Table to Windows Form Application (c#)

Posted By:      Posted Date: September 26, 2010    Points: 0   Category :Windows Application


I have created forms in the past that have connected to a SQL Server database and done a variety of manipulations.

This time I have a static table in SQL server that I want to add to the project and load into an array without having to connect to SQL Server i.e. the windows form application will have this datatable embedded within it so any user can use it. How do I add the table to the project in this way?

I know how to load the data into the array.




View Complete Post

More Related Resource Links

how to change the web application Database connection form Windows authentication to SQL Server acco

Hi, I have a web application created and Database connection authentication was given as Windows authentication. how can i change it to a SQL server account in MOSS 2007. Thanks in advance.

How To connect remote server in windows form application


Hi All

i have implementing one Windows application in that i need to get the Forex market quotes values form perticulat server how can i implement this i have some Php Code but i need to in C# application.

This is my Php code to receive the quotes form server;

define('T_HOST','');  // MetaTrader Server Address  

define('T_PORT',443);                   // MetaTrader Server Port
define('T_TIMEOUT',1);                  // MetaTrader Server Connection Timeout, in sec


define('T_CACHEDIR','cache/');         // cache files directory
define('T_CACHETIME',1);               // cache expiration time, in sec

define('T_CLEAR_DELNUMBER',1);        // limit of deleted files, after which process of cache clearing should be stopped

$MQ_CLEAR_STARTTIME = 0; // time
$MQ_CLEAR_NUMBER = 0;    // deleted files counter

// query quotes and parse result
                          // $re=MQ_Query($q);
$qRes = MQ_Query($q);
function MQ_Query($query,$cacheDir=T_CACHEDIR,$cacheTime=T_CACHETIME,$cacheDirPrefix='')

   $ret = 

Open a windows application form names in another

Hi, Now i am in a horrible situation. I want to create an application for open another application(exe) and display all the form names in newly opened application in a compobox.If we selected a compobox item,ie;a form name in new application opened,i want to display all the control names in that form... is it possible? we can do it in same application.but how can i do it in another application? thanks in advance   Anoop

Transfering Data from Windows form application to a website

Hello Friends I have a windows form application and i have to transfer the data from my forms that have been retrieved from SQL server database to a website. So that i can automate the data entry on the website. Can anybody please tell how should i go about doing this. Thanks & Regards, Syed

how do i create a windows form application login for to validate username and password from sql serv

 I would like to know how I can create a login form for my windows form application. The login form must be linked to a SQL server 2005 express edition database (in which the username and passwords are stored). The login form must validate the user using the database and allow them to access the program. 

Connection to Exchange Server of .NET 1.1 Framework application on Windows 2008 64-bit

I am running Visual Studio 2003 .NET Framework 1.1 application on Windows 2008 64-bit machine. There is only one problem - connection to Exchange Server. The same application is running fine on Windows 7 64-bit machine (not server). I tried to use the same Interop.MAPI.dll I used for Windows 7, but it doesn't work for Windows 2008.   Please help.  

Using Windows Authentication for connecting sql server from web application using froms authenticati

Hi Experts, I have one web application which is configured to be use froms authentication. But, I don't want to use SQL Authentication to connect to SQL server, I want to use windows authentication. Can somebody plase give me detailed setps for how to implement this? Thanks for your help in advance. -Chintak. 

Windows form application, Visual basic 9

please give me vb 9 ( visual studio 2008 ) language example, to create shortcut on the desktop, from file notepad.exe which stored in c:\windows\notepad.exe

Enabling Windows Authentication to SQL Server using Application Pool Credentials

I have created a WCF Service (VS2008), an application pool account which has the access to the SQL Server(in remote machine). Configured the App Pool account to the Virtual Directory in IIS (Version 6.0). Once I browse through the SVC file, I can see the WSDL file. I have the "Windows Authentication" and the 'Anonymous authentication" Checked in the Properties for the Virtual Directory. But when I access service through Client, I get "The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'.". Binding that is being used is HTTPBinding. I have set the Identity Impersonate to True as well. Bottom line is - I need to use the App Pool account to connect to the SQL Server. Could some one please help me in this?  

SelfHosted WCF Service in a Windows Form Application

Hey,   I have a simple console app that is a self hosted service and a second console app that acts as the client.  I can pass a message between the client and service.  Obviously for this to work the service has to stay up and running, so I put a Console.ReadLine(); command as the last line in the service console app to prevent the service from closing until the user presses enter. My problem is, I would like to (self)host the service in a windows form.  If, for example, I put the ServiceHost decleration in the form load method, the service does not stay open once the form load method is complete. Does anyone have any tips on how I can self host the service in a windows form application and keep the service alive?   Thanks ;o)

How to enable own shortcut within WebBrowser control in Windows form application




I am developing a windows form application with C#, where I have placed WebBrowser control... I load some web page in this webbrowser and I need to know, that after I press my own certain shortcut that it will allow me to call my handler...

It should work something like this => I have certain textbox on web page and after pressing my own shortcut, it will call my handler which will automatically type certain text (which will be prepared in that handler) into that textbox... 

Could you advice me, how to make this happen or if it is even possible?


Thanks a lot in advance

adding windows user control in asp.net application


hi fri i had created one user control in c# and i want to add this user control in asp.net application pl tel me how to do this

thanks in advance

A possible bug with redirecting RedirectStandardInput to console application from windows form (Win7


More info can be found on this post:



Basically when I attempt to redirect the standard input of a console application from windows form the console application crashes immediately.


When I use the exact same code from a console application everything works fine (this is what leads me to believe it might be a bug).


Here's the shortest code you need to reproduce the problem:


Process myProcess = new
myProcess.StartInfo.FileName = @"cmd.exe"
myProcess.StartInfo.UseShellExecute = false
myProcess.StartInfo.RedirectStandardInput = true


Please note the following:

1. When I change "cmd.exe" to "sort.exe" it works find on both console and windows form applications.

2. When compiling to windows application for 64 bit platform (or AnyCPU) the "myProcess.MainModule" throws an exception: {"Only part of a ReadProcessMemory or

WriteProcessMemory request was completed"}

3. Whe

Problem hosting a WPF user control in a windows form application

I have a windows forms application and want to to use WPF inside this application. So I have add a WPF user control into my project. Then I take a ElementHost from the toolbox and put it on my windows forms. The problem is now, when I want to add the WPF control with "Edit Host Content" I get the message "This ElementHost is currently not hosting any editable content....." What's wrong? How can I embed my implemented WPF control into the ElementHost ?

Refresh datagridview in windows form application


I am having a main which will have 2 controls namely treeview and datagridview . I will have a form to be opened when user selects an option from treeview. My treeview will be as follows





If i click on the text file that was child to the root i will show the content of that file. But what i need is if right click on child i will have an option as NEW and i will get a new form. If i enter some values and click on save i will save them to the text file which was provided in the treeview at the same time i would like to show the user in the datagridview when the second form gets hide. Like that i can have multiple child forms what ever data i give there in the forms that should be shown to datagridview when the child form gets closed or hide

How should an SQL statement refer to a Text field value on a Windows Form Application?


In a WindowsFormApplication, I have a form that contains an MS Office Spreadsheet (an Office Web component).  The data source of the spreadsheet is  an Oracle table which is referenced in an SQL statement  - for example, the following works fine: 


I've now added a Text field (TextBox1) to the form and would like to have the SQL statement refer to the value of this field.  I've tried various syntaxes, including the following::


This generates an error (ORA00904: "HOST: invalid identifier)

I've also tried the following: 


This generates an error (ORA00904: "FORM1"."TEXTBOX1"."VALUE": invalid identifier)

I'd appreciate any ideas on what the correct syntax should be in referring to the Text field or whether or not this is even possible.


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