how do I early bind

Discussion in 'Microsoft ASP .NET' started by Martin Eyles, Dec 15, 2004.

  1. Martin Eyles

    Martin Eyles Guest

    I have just turned on option strict in ASP/VB.net. I started by happily
    going through and setting up all of the Dim statements with As clauses, and
    making my cast explicit. However, I have now got stuck on "late binding".
    After reading that early binding is faster, I think that it would be best to
    make everything early binding, but I can't work out how. have but a sample
    of my database code below. Can anyone tell me how to fix it?

    Thanks,
    Martin

    Public Sub aSub()
    'Allocate Variables
    Dim adCmdText, aConnectionString, SQL As String
    Dim R, F, RecsAffected As Object
    Dim conn As Object

    'set connection string for login to database
    aConnectionString = "Provider=SQLOLEDB;Data Source=server;" _
    & "Database=aDataBase;UID=aUserID;PWD=aPassword"
    conn = Server.CreateObject("ADODB.Connection") 'make connection
    object
    'send connection string to database, via oject
    conn.ConnectionString = aConnectionString
    'open the connection
    conn.Open()

    SQL = ("SELECT aValue FROM aTable WHERE theCondition='" + aCondition
    + "'")
    R = conn.execute(SQL, RecsAffected, adCmdText)
    For Each F In R.Fields
    Response.Write("") 'do nothing
    Next
    While Not R.EOF
    For Each F In R.Fields
    aValue = F.Value
    Next
    R.MoveNext()
    End While

    conn.Close()
    End Sub

    --
    Martin Eyles
     
    Martin Eyles, Dec 15, 2004
    #1
    1. Advertisements

  2. Martin Eyles

    Karl Seguin Guest

    Marin,
    Glad to see you are turning on Option Explicit and Option Strict.

    You can early bind like this:

    dim connection as System.Data.SqlClient.SqlConnection

    connection = new System.Data.SqlClient.SqlConnection

    of course, if you Import System.Data.SqlClient at the top of your page, this
    looks a lot nicer:

    dim connection as SqlConnection
    connection = new SqlConnection()

    or

    dim connection as SqlConnection = new SqlConnection()


    also look at exception handling (try/catch) and if you are serious about
    properly learning VB.Net, check out
    http://www.amazon.com/exec/obidos/ASIN/0321169514/panopticoncen-20/002-7185744-5788008


    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    "Martin Eyles" <> wrote in message
    news:...
    > I have just turned on option strict in ASP/VB.net. I started by happily
    > going through and setting up all of the Dim statements with As clauses,

    and
    > making my cast explicit. However, I have now got stuck on "late binding".
    > After reading that early binding is faster, I think that it would be best

    to
    > make everything early binding, but I can't work out how. have but a

    sample
    > of my database code below. Can anyone tell me how to fix it?
    >
    > Thanks,
    > Martin
    >
    > Public Sub aSub()
    > 'Allocate Variables
    > Dim adCmdText, aConnectionString, SQL As String
    > Dim R, F, RecsAffected As Object
    > Dim conn As Object
    >
    > 'set connection string for login to database
    > aConnectionString = "Provider=SQLOLEDB;Data Source=server;" _
    > & "Database=aDataBase;UID=aUserID;PWD=aPassword"
    > conn = Server.CreateObject("ADODB.Connection") 'make connection
    > object
    > 'send connection string to database, via oject
    > conn.ConnectionString = aConnectionString
    > 'open the connection
    > conn.Open()
    >
    > SQL = ("SELECT aValue FROM aTable WHERE theCondition='" +

    aCondition
    > + "'")
    > R = conn.execute(SQL, RecsAffected, adCmdText)
    > For Each F In R.Fields
    > Response.Write("") 'do nothing
    > Next
    > While Not R.EOF
    > For Each F In R.Fields
    > aValue = F.Value
    > Next
    > R.MoveNext()
    > End While
    >
    > conn.Close()
    > End Sub
    >
    > --
    > Martin Eyles
    >
    >
    >
     
    Karl Seguin, Dec 15, 2004
    #2
    1. Advertisements

  3. Martin Eyles

    Martin Eyles Guest

    I have done that now, and the connection object complained that it didn't
    have the execute method. I found there is a SqlCommand class too from an
    example in the help, and so have added the following code:-

    anSQLCommand = New System.Data.SqlClient.SqlCommand
    anSQLCommand.Connection() = conn
    anSQLCommand.CommandText = SQL

    My problem is that there are four different execute... methods in the
    SqlCommand object:- NonQuery, Reader, Scalar and XmlReader. Could you
    explain which ones I need, and how to use them? Also, are these ADODB like
    my old code, or are they the new ADO.net classes? Does this make any
    difference?

    Thanks again,
    Martin

    --
    Martin Eyles


    "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
    wrote in message news:...
    > Marin,
    > Glad to see you are turning on Option Explicit and Option Strict.
    >
    > You can early bind like this:
    >
    > dim connection as System.Data.SqlClient.SqlConnection
    >
    > connection = new System.Data.SqlClient.SqlConnection
    >
    > of course, if you Import System.Data.SqlClient at the top of your page,

    this
    > looks a lot nicer:
    >
    > dim connection as SqlConnection
    > connection = new SqlConnection()
    >
    > or
    >
    > dim connection as SqlConnection = new SqlConnection()
    >
    >
    > also look at exception handling (try/catch) and if you are serious about
    > properly learning VB.Net, check out
    >

    http://www.amazon.com/exec/obidos/ASIN/0321169514/panopticoncen-20/002-7185744-5788008
    >
    >
    > Karl
    >
    > --
    > MY ASP.Net tutorials
    > http://www.openmymind.net/
    >
    >
    > "Martin Eyles" <> wrote in message
    > news:...
    > > I have just turned on option strict in ASP/VB.net. I started by happily
    > > going through and setting up all of the Dim statements with As clauses,

    > and
    > > making my cast explicit. However, I have now got stuck on "late

    binding".
    > > After reading that early binding is faster, I think that it would be

    best
    > to
    > > make everything early binding, but I can't work out how. have but a

    > sample
    > > of my database code below. Can anyone tell me how to fix it?
    > >
    > > Thanks,
    > > Martin
    > >
    > > Public Sub aSub()
    > > 'Allocate Variables
    > > Dim adCmdText, aConnectionString, SQL As String
    > > Dim R, F, RecsAffected As Object
    > > Dim conn As Object
    > >
    > > 'set connection string for login to database
    > > aConnectionString = "Provider=SQLOLEDB;Data Source=server;" _
    > > & "Database=aDataBase;UID=aUserID;PWD=aPassword"
    > > conn = Server.CreateObject("ADODB.Connection") 'make connection
    > > object
    > > 'send connection string to database, via oject
    > > conn.ConnectionString = aConnectionString
    > > 'open the connection
    > > conn.Open()
    > >
    > > SQL = ("SELECT aValue FROM aTable WHERE theCondition='" +

    > aCondition
    > > + "'")
    > > R = conn.execute(SQL, RecsAffected, adCmdText)
    > > For Each F In R.Fields
    > > Response.Write("") 'do nothing
    > > Next
    > > While Not R.EOF
    > > For Each F In R.Fields
    > > aValue = F.Value
    > > Next
    > > R.MoveNext()
    > > End While
    > >
    > > conn.Close()
    > > End Sub
    > >
    > > --
    > > Martin Eyles
    > >
    > >
    > >

    >
    >
     
    Martin Eyles, Dec 15, 2004
    #3
  4. Martin Eyles

    Karl Seguin Guest

    Sorry, you are right, I changed you over from ADODB to ADO.Net...it does
    make a difference. I obviously recommend that you move to ADO.Net, but now
    might not be the correct time for you. If you are just doing this for
    learning, strongly consider going with ADO.Net, if you have a deadline for a
    project and ADODB is working, why not wait 'til downtime before rocking the
    boat too much.

    To use ADODB in a strongly-typed manner, you'll need to add a reference to
    Microsoft ActiveX Data Object Library 2.7. You do this in VS.Net by right
    clicking on "referneces", selecting "Add Reference", selecting the "COM" tab
    and then picking that class.

    Once added, you can do thigs like:
    Dim connection As ADODB.Connection = New ADODB.Connection
    connection.ConnectionString = ""

    or

    Dim rs as ADODB.Recordset = .....

    and pretty much use it all like you are used to...

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    "Martin Eyles" <> wrote in message
    news:...
    > I have done that now, and the connection object complained that it didn't
    > have the execute method. I found there is a SqlCommand class too from an
    > example in the help, and so have added the following code:-
    >
    > anSQLCommand = New System.Data.SqlClient.SqlCommand
    > anSQLCommand.Connection() = conn
    > anSQLCommand.CommandText = SQL
    >
    > My problem is that there are four different execute... methods in the
    > SqlCommand object:- NonQuery, Reader, Scalar and XmlReader. Could you
    > explain which ones I need, and how to use them? Also, are these ADODB like
    > my old code, or are they the new ADO.net classes? Does this make any
    > difference?
    >
    > Thanks again,
    > Martin
    >
    > --
    > Martin Eyles
    >
    >
    > "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
    > wrote in message news:...
    > > Marin,
    > > Glad to see you are turning on Option Explicit and Option Strict.
    > >
    > > You can early bind like this:
    > >
    > > dim connection as System.Data.SqlClient.SqlConnection
    > >
    > > connection = new System.Data.SqlClient.SqlConnection
    > >
    > > of course, if you Import System.Data.SqlClient at the top of your page,

    > this
    > > looks a lot nicer:
    > >
    > > dim connection as SqlConnection
    > > connection = new SqlConnection()
    > >
    > > or
    > >
    > > dim connection as SqlConnection = new SqlConnection()
    > >
    > >
    > > also look at exception handling (try/catch) and if you are serious about
    > > properly learning VB.Net, check out
    > >

    >

    http://www.amazon.com/exec/obidos/ASIN/0321169514/panopticoncen-20/002-7185744-5788008
    > >
    > >
    > > Karl
    > >
    > > --
    > > MY ASP.Net tutorials
    > > http://www.openmymind.net/
    > >
    > >
    > > "Martin Eyles" <> wrote in message
    > > news:...
    > > > I have just turned on option strict in ASP/VB.net. I started by

    happily
    > > > going through and setting up all of the Dim statements with As

    clauses,
    > > and
    > > > making my cast explicit. However, I have now got stuck on "late

    > binding".
    > > > After reading that early binding is faster, I think that it would be

    > best
    > > to
    > > > make everything early binding, but I can't work out how. have but a

    > > sample
    > > > of my database code below. Can anyone tell me how to fix it?
    > > >
    > > > Thanks,
    > > > Martin
    > > >
    > > > Public Sub aSub()
    > > > 'Allocate Variables
    > > > Dim adCmdText, aConnectionString, SQL As String
    > > > Dim R, F, RecsAffected As Object
    > > > Dim conn As Object
    > > >
    > > > 'set connection string for login to database
    > > > aConnectionString = "Provider=SQLOLEDB;Data Source=server;" _
    > > > & "Database=aDataBase;UID=aUserID;PWD=aPassword"
    > > > conn = Server.CreateObject("ADODB.Connection") 'make

    connection
    > > > object
    > > > 'send connection string to database, via oject
    > > > conn.ConnectionString = aConnectionString
    > > > 'open the connection
    > > > conn.Open()
    > > >
    > > > SQL = ("SELECT aValue FROM aTable WHERE theCondition='" +

    > > aCondition
    > > > + "'")
    > > > R = conn.execute(SQL, RecsAffected, adCmdText)
    > > > For Each F In R.Fields
    > > > Response.Write("") 'do nothing
    > > > Next
    > > > While Not R.EOF
    > > > For Each F In R.Fields
    > > > aValue = F.Value
    > > > Next
    > > > R.MoveNext()
    > > > End While
    > > >
    > > > conn.Close()
    > > > End Sub
    > > >
    > > > --
    > > > Martin Eyles
    > > >
    > > >
    > > >

    > >
    > >

    >
    >
     
    Karl Seguin, Dec 15, 2004
    #4
  5. Martin Eyles

    Martin Eyles Guest

    I can afford a bit of time to get it going in ADO.net. Have figured out how
    to get one value with scalar now, I think. The only thing now is working
    with more data.

    I am used to:-

    > > > "Martin Eyles" <> wrote in message
    > > > news:...
    > > > > R = conn.execute(SQL, RecsAffected, adCmdText)
    > > > > For Each F In R.Fields
    > > > > Response.Write("") 'do nothing
    > > > > Next
    > > > > While Not R.EOF
    > > > > For Each F In R.Fields
    > > > > aValue = F.Value
    > > > > Next
    > > > > R.MoveNext()
    > > > > End While


    I think the first line should become R=command.executeReader, but what class
    of object is R, and what changes do I have to make to the rest?

    Thanks,
    ME

    --
    Martin Eyles


    "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
    wrote in message news:e$...
    > Sorry, you are right, I changed you over from ADODB to ADO.Net...it does
    > make a difference. I obviously recommend that you move to ADO.Net, but now
    > might not be the correct time for you. If you are just doing this for
    > learning, strongly consider going with ADO.Net, if you have a deadline for

    a
    > project and ADODB is working, why not wait 'til downtime before rocking

    the
    > boat too much.
    >
    > To use ADODB in a strongly-typed manner, you'll need to add a reference to
    > Microsoft ActiveX Data Object Library 2.7. You do this in VS.Net by right
    > clicking on "referneces", selecting "Add Reference", selecting the "COM"

    tab
    > and then picking that class.
    >
    > Once added, you can do thigs like:
    > Dim connection As ADODB.Connection = New ADODB.Connection
    > connection.ConnectionString = ""
    >
    > or
    >
    > Dim rs as ADODB.Recordset = .....
    >
    > and pretty much use it all like you are used to...
    >
    > Karl
    >
    > --
    > MY ASP.Net tutorials
    > http://www.openmymind.net/
    >
    >
    > "Martin Eyles" <> wrote in message
    > news:...
    > > I have done that now, and the connection object complained that it

    didn't
    > > have the execute method. I found there is a SqlCommand class too from an
    > > example in the help, and so have added the following code:-
    > >
    > > anSQLCommand = New System.Data.SqlClient.SqlCommand
    > > anSQLCommand.Connection() = conn
    > > anSQLCommand.CommandText = SQL
    > >
    > > My problem is that there are four different execute... methods in the
    > > SqlCommand object:- NonQuery, Reader, Scalar and XmlReader. Could you
    > > explain which ones I need, and how to use them? Also, are these ADODB

    like
    > > my old code, or are they the new ADO.net classes? Does this make any
    > > difference?
    > >
    > > Thanks again,
    > > Martin
    > >
    > > --
    > > Martin Eyles
    > >
    > >
    > > "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
    > > wrote in message news:...
    > > > Marin,
    > > > Glad to see you are turning on Option Explicit and Option Strict.
    > > >
    > > > You can early bind like this:
    > > >
    > > > dim connection as System.Data.SqlClient.SqlConnection
    > > >
    > > > connection = new System.Data.SqlClient.SqlConnection
    > > >
    > > > of course, if you Import System.Data.SqlClient at the top of your

    page,
    > > this
    > > > looks a lot nicer:
    > > >
    > > > dim connection as SqlConnection
    > > > connection = new SqlConnection()
    > > >
    > > > or
    > > >
    > > > dim connection as SqlConnection = new SqlConnection()
    > > >
    > > >
    > > > also look at exception handling (try/catch) and if you are serious

    about
    > > > properly learning VB.Net, check out
    > > >

    > >

    >

    http://www.amazon.com/exec/obidos/ASIN/0321169514/panopticoncen-20/002-7185744-5788008
    > > >
    > > >
    > > > Karl
    > > >
    > > > --
    > > > MY ASP.Net tutorials
    > > > http://www.openmymind.net/
     
    Martin Eyles, Dec 15, 2004
    #5
  6. Martin Eyles

    Karl Seguin Guest

    SqlDataReader dr = command.executeReader()
    while dr.Read()
    dim someField as string = cstr(dr("someColumn"))
    end while

    you might wanna check out an introduction on this sorta stuff such as
    (http://www.sitepoint.com/article/introduction-ado-net/2) which I just got
    from a google search...

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    "Martin Eyles" <> wrote in message
    news:...
    > I can afford a bit of time to get it going in ADO.net. Have figured out

    how
    > to get one value with scalar now, I think. The only thing now is working
    > with more data.
    >
    > I am used to:-
    >
    > > > > "Martin Eyles" <> wrote in message
    > > > > news:...
    > > > > > R = conn.execute(SQL, RecsAffected, adCmdText)
    > > > > > For Each F In R.Fields
    > > > > > Response.Write("") 'do nothing
    > > > > > Next
    > > > > > While Not R.EOF
    > > > > > For Each F In R.Fields
    > > > > > aValue = F.Value
    > > > > > Next
    > > > > > R.MoveNext()
    > > > > > End While

    >
    > I think the first line should become R=command.executeReader, but what

    class
    > of object is R, and what changes do I have to make to the rest?
    >
    > Thanks,
    > ME
    >
    > --
    > Martin Eyles
    >
    >
    > "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
    > wrote in message news:e$...
    > > Sorry, you are right, I changed you over from ADODB to ADO.Net...it does
    > > make a difference. I obviously recommend that you move to ADO.Net, but

    now
    > > might not be the correct time for you. If you are just doing this for
    > > learning, strongly consider going with ADO.Net, if you have a deadline

    for
    > a
    > > project and ADODB is working, why not wait 'til downtime before rocking

    > the
    > > boat too much.
    > >
    > > To use ADODB in a strongly-typed manner, you'll need to add a reference

    to
    > > Microsoft ActiveX Data Object Library 2.7. You do this in VS.Net by

    right
    > > clicking on "referneces", selecting "Add Reference", selecting the "COM"

    > tab
    > > and then picking that class.
    > >
    > > Once added, you can do thigs like:
    > > Dim connection As ADODB.Connection = New ADODB.Connection
    > > connection.ConnectionString = ""
    > >
    > > or
    > >
    > > Dim rs as ADODB.Recordset = .....
    > >
    > > and pretty much use it all like you are used to...
    > >
    > > Karl
    > >
    > > --
    > > MY ASP.Net tutorials
    > > http://www.openmymind.net/
    > >
    > >
    > > "Martin Eyles" <> wrote in message
    > > news:...
    > > > I have done that now, and the connection object complained that it

    > didn't
    > > > have the execute method. I found there is a SqlCommand class too from

    an
    > > > example in the help, and so have added the following code:-
    > > >
    > > > anSQLCommand = New System.Data.SqlClient.SqlCommand
    > > > anSQLCommand.Connection() = conn
    > > > anSQLCommand.CommandText = SQL
    > > >
    > > > My problem is that there are four different execute... methods in the
    > > > SqlCommand object:- NonQuery, Reader, Scalar and XmlReader. Could you
    > > > explain which ones I need, and how to use them? Also, are these ADODB

    > like
    > > > my old code, or are they the new ADO.net classes? Does this make any
    > > > difference?
    > > >
    > > > Thanks again,
    > > > Martin
    > > >
    > > > --
    > > > Martin Eyles
    > > >
    > > >
    > > > "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME

    net>
    > > > wrote in message news:...
    > > > > Marin,
    > > > > Glad to see you are turning on Option Explicit and Option Strict.
    > > > >
    > > > > You can early bind like this:
    > > > >
    > > > > dim connection as System.Data.SqlClient.SqlConnection
    > > > >
    > > > > connection = new System.Data.SqlClient.SqlConnection
    > > > >
    > > > > of course, if you Import System.Data.SqlClient at the top of your

    > page,
    > > > this
    > > > > looks a lot nicer:
    > > > >
    > > > > dim connection as SqlConnection
    > > > > connection = new SqlConnection()
    > > > >
    > > > > or
    > > > >
    > > > > dim connection as SqlConnection = new SqlConnection()
    > > > >
    > > > >
    > > > > also look at exception handling (try/catch) and if you are serious

    > about
    > > > > properly learning VB.Net, check out
    > > > >
    > > >

    > >

    >

    http://www.amazon.com/exec/obidos/ASIN/0321169514/panopticoncen-20/002-7185744-5788008
    > > > >
    > > > >
    > > > > Karl
    > > > >
    > > > > --
    > > > > MY ASP.Net tutorials
    > > > > http://www.openmymind.net/

    >
    >
     
    Karl Seguin, Dec 15, 2004
    #6
  7. Martin Eyles

    Martin Eyles Guest

    Thankyou,
    I think there is plenty of information to read on this. I had
    googled a bit, but it helps to know what you are googling for, so thanks for
    the link too.

    ME

    --
    Martin Eyles


    "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
    wrote in message news:...
    > SqlDataReader dr = command.executeReader()
    > while dr.Read()
    > dim someField as string = cstr(dr("someColumn"))
    > end while
    >
    > you might wanna check out an introduction on this sorta stuff such as
    > (http://www.sitepoint.com/article/introduction-ado-net/2) which I just got
    > from a google search...
    >
    > Karl
    >
    > --
    > MY ASP.Net tutorials
    > http://www.openmymind.net/
    >
    >
    > "Martin Eyles" <> wrote in message
    > news:...
    > > I can afford a bit of time to get it going in ADO.net. Have figured out

    > how
    > > to get one value with scalar now, I think. The only thing now is working
    > > with more data.
    > >
    > > I am used to:-
    > >
    > > > > > "Martin Eyles" <> wrote in message
    > > > > > news:...
    > > > > > > R = conn.execute(SQL, RecsAffected, adCmdText)
    > > > > > > For Each F In R.Fields
    > > > > > > Response.Write("") 'do nothing
    > > > > > > Next
    > > > > > > While Not R.EOF
    > > > > > > For Each F In R.Fields
    > > > > > > aValue = F.Value
    > > > > > > Next
    > > > > > > R.MoveNext()
    > > > > > > End While

    > >
    > > I think the first line should become R=command.executeReader, but what

    > class
    > > of object is R, and what changes do I have to make to the rest?
    > >
    > > Thanks,
    > > ME
    > >
    > > --
    > > Martin Eyles
    > >
    > >
    > > "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
    > > wrote in message news:e$...
    > > > Sorry, you are right, I changed you over from ADODB to ADO.Net...it

    does
    > > > make a difference. I obviously recommend that you move to ADO.Net, but

    > now
    > > > might not be the correct time for you. If you are just doing this for
    > > > learning, strongly consider going with ADO.Net, if you have a deadline

    > for
    > > a
    > > > project and ADODB is working, why not wait 'til downtime before

    rocking
    > > the
    > > > boat too much.
    > > >
    > > > To use ADODB in a strongly-typed manner, you'll need to add a

    reference
    > to
    > > > Microsoft ActiveX Data Object Library 2.7. You do this in VS.Net by

    > right
    > > > clicking on "referneces", selecting "Add Reference", selecting the

    "COM"
    > > tab
    > > > and then picking that class.
    > > >
    > > > Once added, you can do thigs like:
    > > > Dim connection As ADODB.Connection = New ADODB.Connection
    > > > connection.ConnectionString = ""
    > > >
    > > > or
    > > >
    > > > Dim rs as ADODB.Recordset = .....
    > > >
    > > > and pretty much use it all like you are used to...
    > > >
    > > > Karl
    > > >
    > > > --
    > > > MY ASP.Net tutorials
    > > > http://www.openmymind.net/
    > > >
    > > >
    > > > "Martin Eyles" <> wrote in message
    > > > news:...
    > > > > I have done that now, and the connection object complained that it

    > > didn't
    > > > > have the execute method. I found there is a SqlCommand class too

    from
    > an
    > > > > example in the help, and so have added the following code:-
    > > > >
    > > > > anSQLCommand = New System.Data.SqlClient.SqlCommand
    > > > > anSQLCommand.Connection() = conn
    > > > > anSQLCommand.CommandText = SQL
    > > > >
    > > > > My problem is that there are four different execute... methods in

    the
    > > > > SqlCommand object:- NonQuery, Reader, Scalar and XmlReader. Could

    you
    > > > > explain which ones I need, and how to use them? Also, are these

    ADODB
    > > like
    > > > > my old code, or are they the new ADO.net classes? Does this make any
    > > > > difference?
    > > > >
    > > > > Thanks again,
    > > > > Martin
    > > > >
    > > > > --
    > > > > Martin Eyles
    > > > >
    > > > >
    > > > > "Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME

    > net>
    > > > > wrote in message news:...
    > > > > > Marin,
    > > > > > Glad to see you are turning on Option Explicit and Option Strict.
    > > > > >
    > > > > > You can early bind like this:
    > > > > >
    > > > > > dim connection as System.Data.SqlClient.SqlConnection
    > > > > >
    > > > > > connection = new System.Data.SqlClient.SqlConnection
    > > > > >
    > > > > > of course, if you Import System.Data.SqlClient at the top of your

    > > page,
    > > > > this
    > > > > > looks a lot nicer:
    > > > > >
    > > > > > dim connection as SqlConnection
    > > > > > connection = new SqlConnection()
    > > > > >
    > > > > > or
    > > > > >
    > > > > > dim connection as SqlConnection = new SqlConnection()
    > > > > >
    > > > > >
    > > > > > also look at exception handling (try/catch) and if you are serious

    > > about
    > > > > > properly learning VB.Net, check out
    > > > > >
    > > > >
    > > >

    > >

    >

    http://www.amazon.com/exec/obidos/ASIN/0321169514/panopticoncen-20/002-7185744-5788008
    > > > > >
    > > > > >
    > > > > > Karl
    > > > > >
    > > > > > --
    > > > > > MY ASP.Net tutorials
    > > > > > http://www.openmymind.net/

    > >
    > >

    >
    >
     
    Martin Eyles, Dec 16, 2004
    #7
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Heidi Hundåla

    Page_Unload event fires to early

    Heidi Hundåla, Oct 22, 2003, in forum: Microsoft ASP .NET
    Replies:
    15
    Views:
    632
    Jeffrey Tan[MSFT]
    Nov 10, 2003
  2. Shawn

    how to do early-binding on repeater

    Shawn, Dec 8, 2003, in forum: Microsoft ASP .NET
    Replies:
    0
    Views:
    249
    Shawn
    Dec 8, 2003
  3. Max

    dynamically change table with early binding?

    Max, Jan 3, 2004, in forum: Microsoft ASP .NET
    Replies:
    1
    Views:
    142
    Natty Gur
    Jan 4, 2004
  4. Shimon Sim

    Form indetification session expires to early

    Shimon Sim, Apr 19, 2004, in forum: Microsoft ASP .NET
    Replies:
    2
    Views:
    140
    Steven Cheng[MSFT]
    Apr 22, 2004
  5. mr2_93
    Replies:
    1
    Views:
    495
    mr2_93
    Oct 2, 2005
Loading...

Share This Page