Creating Table to Connect to a SQL Server Table

Hello everyone!

I need to create some tables when my web page is been created these tables are in a SQL server database. I found a sample code to do that using a Access table can someone please send me or point me out to some link where I can learn how to do that.




-------------- Sample code I got from the net -----


void buildGrid()


string sql;

sql =

"SELECT * FROM Products";


OleDbDataAdapter daSrc = new System.Data.OleDb.OleDbDataAdapter (sql, dbCon);

DataTable oTable1 = new DataTable("Products");


sql =

"SELECT * FROM Categories";

daSrc =

new System.Data.OleDb.OleDbDataAdapter (sql, dbCon);

DataTable oTable2 = new DataTable("Categories");


DataSet dsSrc = new DataSet();




"Categories"].Columns["CategoryId"], dsSrc.Tables["Products"].Columns["CategoryId"]);

Grid1.DataSource = dsSrc;


Charles Urbina
Solucion Software Corp.
6/22/2006 7:36:56 PM 16182 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 25
Get it on Google Play
Get it on Apple App Store

Hi, here is a good VB example:

Welcome to my SQL/ASPNET forum for Chinese
6/23/2006 7:07:36 AM

Thanks I downloaded the file.


I just wonder is there a sample for C#?



Charles Urbina
Solucion Software Corp.
6/24/2006 12:24:49 AM

Similar Artilces:

Why I cannot create/edit tables in VS.Net Server explorer for SQL Server 2000 Developer local database?
I found that when I install MSDE, then I can create/edit database objects for MSDE database in Visual Studio 2003 Server Explorer, but when I try to create/edit database objects under the default database created by the SQL Server 2000 installation, I cannot do these tasks as no option for these tasks appear when I right-click on the database object in Server Explorer.  Anyone knows why this is happening?sun21170 I reproed your issue. And I found in MSDN it is said the Server Explorer can: -Open and view Server Explorer -Add a data connection -Add a server -Drag a...

How can i import records from a sql server table in project1 to another sql server table in project2
Hi, i have a table with all employee bio-data in a completed project. Iam now working on another project with a table that needs the same data and here iam talking about 300 records that rarely change. Instead of re-entering this data in this new table, i want to import the data from the completed project into a table in this new project. Does any one have any idea how to achieve that or is there a better option to do the same. One more thing iam realising here is that iam going to use this same data in very many applications and some one from one department is going to ...

I imported a SQL Table into SQL DataBase, But I can not update this table even with SQL Server management Studio
I imported a SQL Table into SQL DataBase, But I can not update this table even with SQL Server management Studio When I change any data on mentioned table above, Red exclamation sign appears left of the record . How can I correct this problem?  Thanks. Try running the UPDATE via Query Analyzer...and see if you get an error.***********************Dinakar NethiLife is short. Enjoy it.***********************...

how to create remote server? i want to create proxy table,but can't connect the remote server sit!
You need to enable CIS (sp_configure 'enable cis', 1) and add an entry to master..sysservers for your remote server using sp_addserver. If the remote server is a Sybase server then a srvclass of 7 is required - I think that's the default if you specify the procedure parameter as null. ...

create default tables, procedures, etc. on newly connected remote SQL server
I have a website I'm ready to test on the server it will call home. I just got connected to the remote SQL server that it will be using. As I've been creating the site, I've been using the default SQL Express set-up in Visual Studio. Is there a way to have Visual Studio create all those default tables, procedures, etc. OR is there a way to copy all of that stuff from the SQL Express running on my machine to the remote SQL Server 2005? -MathmindedMathmindedmathminded at hotmail dot com There are many ways to move the database, but the best is Backup and Restore because it moves everything ...

Create Table syntax SQL in SQL Server 7
Hi guys, I need to pass some SQL to someone else who will run it on their database. I have got the SQL for SQL Server 2000 but they are running SQL Server 7. Apparently the below MSSQL 2000 script doesn't work; SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[tableName]( [id] [int] IDENTITY(1,1) NOT NULL, [ArticleID] [int] NULL, [Heading] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [BodyContent] [text] COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [WrittenDate] [datetime] NULL, CONSTRAINT [tableName] PRIMARY KEY CLUSTERED ( [id] ASC )...

how to join existing table with table created by "create existing table"
"create existing table" can help to create a table which is linked to a sp select selection. but can this table be join to other physical tables? Yes, proxy tables can be used in joins. -bret ymho wrote: > "create existing table" can help to create a table which is > linked to a sp select selection. > but can this table be join to other physical tables? but i cant, pls refer my example below: create procedure po_t1 (@p1 char(8) ) as begin select ret_date=convert(datetime,@p1) end go CREATE EXISTING TABLE t1 (ret_out1 datetime not null, ...

Linking SQL Server Tables to Access Tables
Hi,  I would like to link a table in SQL Server to a table in access, because I would like to compare data. But would like to do it through a Stored Procedure.   I would like to do something in this line : If Field1 in SQL Table = Field1 in Access Table then Field2 in SQL Table must = Field2 in Access Table Hope this makes sense. But I have NO idea how to do this ? Can anyone assist ? Thank you ok Ive done this :  Dim connString_MI As String = ConfigurationManager.AppSettings("RMCS.ConnectionString") Dim myConnection_MI As New System.Data.SqlClient.SqlConn...

export from sql server table into oracle table
Hi, i'm trying to export from sql server table into oracle table but it's alway failure if the table has at least one column of nchar or nvarchar datatype. Can anybody explain why ? i need some columns in char or nvarchar type do contain unicode characters. Thanks in advance ! Hi, With the limited information you've provided, my quess would be that you're using Micrsoft's OLEDB provider via Linked Server, and it doesnt support N datatypes.;EN-US;Q244661&ID=KB;EN-US;Q244661 Note also that you dont have to use ...

how to convert sql server table to XML table
Hi   I have a sql server database with some tables.   I am using tree control in my application which needs XML data source only.   I want to bind my SQL server table to tree control with column names at nodes etc.   How to convert this sql table to XML and how to make it as a XML datasource.   Thanks Hiyou can get the  XML string in C# only.dataset ds = new dataset("treecontrol"); ds.tables[0]  = (datatable)GetData(); // which will return the data table from DB.ds.GetXml();  ---------------------------------------------...

table = table object
hi, how to copy the all rows of a table to temporary table using javascript i have tried like this but it's not working ex:document.getelementbyId('tmpTable')=document.getelementbyId('baseTable'); is there any way to do this..?? thanks... icanmakeiteasy put both tables in 2 divs and do div1.innerHTML = div2.innerHTML;MAKMark as Answer if this reply helps youMVP ASP/ASP.NetASP.Net Hosting : Host DepotMy Site : ASPSnippets i have tried that tooo... not workingicanmakeiteasy you are doing right. just change thisvar tempTable ;tempTable=document.gete...

Create table hangs but table was created on Solaris. In a Java application, we create small tables on the fly "create table MyTable (id char(20) NOT NULL)". It's been there for quite a while. Then in the middle of one day, every time it hangs there. We then tried it on isql, same behavior. Then we found that even though the call didn't return, the table was actually created on the database. This lasted for about two hours. Then it went back to normal behavior. Could anyone think of what might have caused it? Thanks, Bill ...

create table statement not creating table
This is a multi-part message in MIME format. ------=_NextPart_000_0008_01C5515B.09D1B7E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Version ASA9.0.1 build 1964 I have a script that I apply to our databases to add tables, triggers, = stored procedures,... using dbisqlc. When I run the script on a particular database 3 tables are not getting = created properly. I am not seeing any errors in the isql.txt file = created by dbisqlc regarding the table create, but later when I try = adding triggers on the new tables I receiv...

Connect to a sql server table
I have a sysbase IQ database and I need to be able to access a table stored in a SQL server database can someone please point me in the right direction Take a look to the chapter 15 of the administration an performance Guide, you must to create a server pointing to sql server and then a proxy table. The command are very simple but I'm tested with MS access and Oracle and with both i getting a lot of trouble.. I wish you have better luck > I have a sysbase IQ database and I need to be able to > access a table stored in a SQL server database can someone > please poin...

Web resources about - Creating Table to Connect to a SQL Server Table -

Wikipedia:Creating a bot - Wikipedia, the free encyclopedia
It is often far simpler to request a bot job from an existing bot. If you have only periodic requests or are uncomfortable with programming languages, ...

U.K. Woman Faces 20 Months For Creating Fake Facebook Accounts, Sending Herself Abusive Messages
A woman in Cornwall in the U.K. came up with a creative way to use Facebook to accelerate a family spat, and it earned her 20 months in prison. ...

Sandi Krakowski’s Tips for Creating Great Content
Quick tips to help you create great content for your business.

Bug - Creating a Video.Watches Action stopped working - Facebook-Entwickler
Since today executing a POST on a me/video.wacthes endpoints no longer works, it was working around 10 hours ago since then the call always returns ...

Facebook simplifies process for creating repeat events
Facebook introduced a new feature for events this week that allows users to quickly create a similar event as one they previously hosted or attended. ...

The Obama campaign won by creating their own Facebook, with unique features for political campaigns.
... seen as too dangerous to nominate someone who is so thoroughly narcissistic, arrogant and dishonest. The Obama campaign won basically by creating ...

Creating A Road Map To Market Your Startup
Spreading the word can be challenging when you’re new to an industry, don’t have a big budget, and have little helpbut it’s possible.You’ll need ...

Dance Machine - The Fun Video Editor for Creating Music Videos to share on Instagram, Facebook, Vine ...
Get Dance Machine - The Fun Video Editor for Creating Music Videos to share on Instagram, Facebook, Vine, and Twitter on the App Store. See screenshots ...

Creating Economic Dynamism: Joseph E. Stiglitz
DAVOS/SWITZERLAND, 25JAN13 - Joseph E. Stiglitz, Professor, Columbia University, USA talks during the session 'Creating Economic Dynamism' at ...

YouTube - Super Human Abilities: Tila Tequila Creating Energy Balls & Electricity Out of Thin Air!
Veröffentlicht am 24.04.2013 Hey Guys! For a long time now I have been able to do some pretty supernatural things that most would consider "SUPER ...

Resources last updated: 1/11/2016 1:00:46 AM