Hi,

Still insist in calling you new in ASP.NET when suddently happens that
the trouble is with ADO.NET. the sequence you need is open a
connection (DbConnection, it may be: OdbcConnection, SqlConnection,
OleDbConnection, OracleConnection...), create a command (DbCommand, it
may be: OdbcCommand, SqlCommand, OleDbCommand, OracleCommand...) to
query the db, the command needs to know the connection and the query
string, then you need to ensure the connection is open (you may have
done that before creating the command, it's ok), and then execute the
command (ExecuteNonQuery for the insert/update/delete, ExecuteReader
for the select), in the case of ExecuteReader, it will return a reader
(DbDataReader, it may be: OdbcDataReader, SqlDataReader,
OleDbDataReader, OracleDataReader...), then you use the reader to
iterate trhu the result and do your stuff after which you can close
the connection. An extra step you can do is create an Adapter
(DbDataAdapter, it may be... you know) and use the adapter to fill a
DataTable or a DataSet with the info returned by the select, then you
can close the connection and iterate thru the DataTable/DataSet and do
your stuff.

Search on MSDN those classes, there are examples.

Guys around here usually go with the sql* classes, those are for SQL
Server. I prefer OleDb as I can use it for more database engines
without the need to ask to manually set the sources as in Odbc ones.
Also It is possible to find a specific provider for all the mayor
database engines (such as Oracle), for example you can download MySql
provider for .NET from their web page. If you know what database
engine you are using go with the provider specific for that one.

Hope this helps

Theraot

On 19 mayo, 14:02, Awais <[email protected]> wrote:
> Oh Many Thanks to *Naveen Kumar* and *Jamie Fraser*.  u both understood my
> question about 99%
> one question from Jamie Fraser and my question will this work if i want to
> make changes from the same table. e.g
>
> OPEN DB
> INSERT DATA           // insertation in same table
> OPEN DB
> SELECT DATA          //selection from same table
> CLOSE DB
> CLOSE DB
>
> and it will be great pleasure if u give me the working code of the above,
> and if u cant then no problem. well many thanks to answer my stupid question
> (i'm very new to asp.net) :(
>
> On Wed, May 19, 2010 at 5:07 PM, Jamie Fraser <[email protected]>wrote:
>
>
>
> > Essentially, you are doing
>
> > OPEN DB
> > INSERT DATA
> > OPEN DB
> > SELECT DATA
> > CLOSE DB
> > CLOSE DB
>
> > The problem here is that you don't indicate whether you are using 1 or
> > more connections. If you are using a single DB connection, it will
> > fail. If you have 2 connections, it will work.
>
> > On Tue, May 18, 2010 at 4:57 PM, Awais <[email protected]> wrote:
> > > lol, i'm getting funny replys . yes im newbie to asp.net. :(
> > > i made a one change, now please tell me is this possible? will my
> > function
> > > my_function_call work correctly.
> > > protected void btsignup_Click(object sender, EventArgs e)
> > >     {
>
> > >         if (Page.IsValid)
> > >         {
> > >                          database open
> > >                         //some DataBase stuff  (here i want to use Insert
> > > Query)
>
> > >                        my_function_call( some_var);   //my change
> > >                              databe close    //my change
>
> > >             public void my_function_call(string  some_var)
> > >             {
> > >                       database open
> > >                         //some DataBase stuff  (here i want to use Select
> > > Query)
> > >                         databe close
> > >             }
> > >        }
> > > }
> > > On Tue, May 18, 2010 at 11:49 AM, Theraot <[email protected]> wrote:
>
> > >> May be you want to see something about anon methods:
> > >>http://msdn.microsoft.com/en-us/library/0yw3tz5k(VS.80).aspx
> > >> Lambda Expressions:
> >http://msdn.microsoft.com/en-us/library/bb397687.aspx
> > >> And LINQ:http://msdn.microsoft.com/es-es/library/bb397965(VS.90).aspx
>
> > >> Just because If I understand your pseudocode you have a function
> > >> inside of another, and that's the part that requires more chemical
> > >> synapse in newbies brains.
>
> > >> Now is it possible, yes, you just did it! You posted that here.
> > >> Now if "achive" is "archive" then don't worry, google groups have this
> > >> thread already archived in their server >.<.
> > >> And last, alternative solutions... there are a couple from ask better
> > >> to pay me passing through finding something else to do, and of course
> > >> you can always suicide.
>
> > >> Is just my idead or awais is feeling too shame :P
>
> > >> Theraot.
>
> > >> On 16 mayo, 03:32, Awais <[email protected]> wrote:
> > >> > Is it possible or how can i achive this? or tell me plz alternative
> > >> > solution. Thanks in advance.
>
> > >> >  protected void btsignup_Click(object sender, EventArgs e)
> > >> >     {
>
> > >> >         if (Page.IsValid)
> > >> >         {
> > >> >                          database open
>
> > >> >                         //some DataBase stuff  (here i want to use
> > >> > *Insert
> > >> > Query*)
>
> > >> >                         databe close
>
> > >> >                        *my_function_call*( some_var);
>
> > >> >             public void *my_function_call*(string  some_var)
> > >> >             {
> > >> >                       database open
>
> > >> >                         //some DataBase stuff  (here i want to use
> > >> > *Select
> > >> > Query*)
>
> > >> >                         databe close
>
> > >> >             }
> > >> >        }
>
> > >> > }

Reply via email to