Re: Get 1st record in ADO.Net

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance





sam wrote:
> I not familiar at ASP.Net 1.1 because I were ASP 3.0 programmer.
>
> I just wanna get 1st record in data but I don't know to code at ASP.Net 1.1
>
>
> ASP 3.0
> -------
> Set rsFILE = Server.CreateObject("ADODB.Recordset")
> rsFILEstatm = "SELECT * FROM F4111 ORDER BY ILUKID DESC"
> rsFILE.Open rsFILEstatm, ConnAS400
>
> rsFILE.movefirst
>
> lastnum = CDbl(rsFILE("ILUKID"))
>
> rsFILE.close
> Set rsFILE = Nothing
> Set rsFILEstatm = Nothing
>
>
> Asp.Net 1.1
> -----------
> Dim constrDBL As String = "server='SQLSVR'; Database='JDE_ERP'"
'make the following changes:
Dim constrDBL As String = "server=SQLSVR; Database=JDE_ERP"

> Dim sqlconDBL As System.Data.SqlClient.SqlConnection = New
> System.Data.SqlClient.SqlConnection(constrDBL)
> Dim sqlcmdDBL As System.Data.SqlClient.SqlCommand = New
> System.Data.SqlClient.SqlCommand("SELECT * FROM F4111 ORDER BY ILUKID DESC",
> sqlconDBL)
>
> Try
> sqlconDBL.Open
>
> Dim dbrDBL As System.Data.SqlClient.SqlDataReader =
> sqlcmdDBL.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
>
> Do While dbrDateFr.Read
>
> ' How to write get first record then exit
> TextBox1.Text = dbrDBL("NAME")
'if the database is having a column name as "name"; then the
'textbox "textbox" will contain the first record of that column

> Loop
>
> sqlcmdDBL = Nothing
> dbrDBL = Nothing
> Finally
> sqlconDBL.Close
> sqlconDBL.Dispose()
>
> End Try
>
> constrDBL = Nothing
> sqlconDBL = Nothing
>
> Please guide me.
>
> Many thanks.

.



Relevant Pages

  • RE: Get 1st record in ADO.Net
    ... > Set rsFILE = Nothing ... > Dim sqlconDBL As System.Data.SqlClient.SqlConnection = New ... > Dim dbrDBL As System.Data.SqlClient.SqlDataReader = ...
    (microsoft.public.dotnet.framework.adonet)
  • Get 1st record in ADO.Net
    ... Set rsFILE = Server.CreateObject ... Dim sqlconDBL As System.Data.SqlClient.SqlConnection = New ... Dim dbrDBL As System.Data.SqlClient.SqlDataReader = ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Error extracting innerHTML using DHTML in an HTA page
    ... I originally started with an ASP page that returned the XML data island. ... > Dim objDoc As Object ... > Dim strHTML As String ...
    (microsoft.public.scripting.vbscript)
  • Re: Cannot instantiate .NET Class Library to expose webservice client library
    ... Web Service calls to ASP pages. ... gacutil /i and regasm the class library with no problem ... Dim objOnlyOrderLine As New iPubClient.OrderLine ... Dim objOnlyOrder As New iPubClient.SimpleOrderData ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Cannot instantiate .NET Class Library to expose webservice client library
    ... Web Service calls to ASP pages. ... gacutil /i and regasm the class library with no problem ... Dim objOnlyOrderLine As New iPubClient.OrderLine ... Dim objOnlyOrder As New iPubClient.SimpleOrderData ...
    (microsoft.public.dotnet.framework)