Re: Get 1st record in ADO.Net
- From: "A.J" <ajay.bisht@xxxxxxxxx>
- Date: 5 Jun 2005 22:28:44 -0700
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.
.
- References:
- Get 1st record in ADO.Net
- From: sam
- Get 1st record in ADO.Net
- Prev by Date: part 2 - I don't understand how Visual Studio does DataSet addition
- Next by Date: Re: 2nd Connection Pass Fails
- Previous by thread: Get 1st record in ADO.Net
- Next by thread: Re: Get 1st record in ADO.Net
- Index(es):
Relevant Pages
|