Re: Listing Records From DB
From: A P (ap_at_textguru.ph)
Date: 09/16/04
- Next message: A P: "Visual Studio .Net Reference?"
- Previous message: Bogdan: "Re: how to create DLL"
- In reply to: Cowboy \(Gregory A. Beamer\): "Re: Listing Records From DB"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 16 Sep 2004 12:22:54 +0800
Thanks for your reply. How about on VB? Not familiar of C# and I only
install VB.Net on my machine.
"Cowboy (Gregory A. Beamer)" <NoSpamMgbworld@comcast.netNoSpamM> wrote in
message news:uzXqTW5mEHA.3296@TK2MSFTNGP10.phx.gbl...
> You have two options, DataReader or DataSet. Here is a dataset
> implementation in C#.
>
> string connString = "YourConnStringHere";
> string sql = "SELECT * FROM SomeTable";
>
> SqlConnection conn = new SqlConnection(connString);
> SqlCommand cmd = new SqlCommand(sql, conn);
> SqlAdapter adapt = new SqlAdapter(cmd);
> DataSet ds = new DataSet();
>
> //optionally using statement here
> try
> {
> conn.Open();
> adapt.Fill(ds);
> }
> finally
> {
> if(conn.State=ConnectionState.Open)
> conn.Close();
>
> conn.Dispose();
> }
>
> DataGrid1.DataSource=ds;
> DataGrid1.DataBind();
>
> Very simple pattern. Easily adaptable.
>
> --
> Gregory A. Beamer
> MVP; MCP: +I, SE, SD, DBA
>
> *************************************************
> Think outside the box!
> *************************************************
> "A P" <ap@textguru.ph> wrote in message
> news:et9rC44mEHA.3464@tk2msftngp13.phx.gbl...
> >I am new to VS.Net Professional but I am previously using Visual Interdev
> > 6.0 . I want to list records from the database thru VS.Net . Its easy on
> > Visual Interdev but in VS .Net, I dont know how. Please help me!!!
> >
> > Me
> >
> >
>
>
- Next message: A P: "Visual Studio .Net Reference?"
- Previous message: Bogdan: "Re: how to create DLL"
- In reply to: Cowboy \(Gregory A. Beamer\): "Re: Listing Records From DB"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|