I think you are new in .net. You might me migrating from ASP 3.0.

First of all there is no recordset concept in .net.

SqlRs = sqlcmd.ExecuteReader()

ExecuteReader will return a reader so declare a SqlDataReader

Say

SqlDataReader reader;

Now

Reader= sqlcmd.ExecuteReader();

Check if the reader contains data

If(reader.Read())

Now read the number of columns returned in your case it should be 3.

reader["EST_NAME"].ToString();

reader["OFF_NAME"].ToString();

reader["node"].ToString();

multiple rows might be returned depending upon the query if the number of
results returned is one do this to print on the label

label1= reader["EST_NAME"].ToString()+”, ”+reader["OFF_NAME "].ToString()+”,
”+reader["node "].ToString()

On Wed, Jul 8, 2009 at 11:30 AM, gagandeep sharma
<[email protected]>wrote:

> strsql1 =
> " select EST_NAME + ',' + OFF_NAME + ',' + DIS_NAME as node from
> grievancedetailscomplete where (EST_CODE='" & PEN_EST_CODE & "' AND
> GRV_CODE=" & PEN_GRV_CODE & ")"
>
> dbcon =
> New SqlConnection(ConfigurationManager.ConnectionStrings(
> "PGConnectionString").ConnectionString)
>
> sqlcmd =
> New SqlCommand(strsql1, dbcon)
>
> sqlcmd.CommandText = strsql1
>
> sqlcmd.CommandType = CommandType.Text
>
> dbcon.Open()
>
> SqlRs = sqlcmd.ExecuteReader()
>
> Label1.Text = strsql1
>
> sqlcmd.Dispose()
>
> dbcon.Close()
>
>
>
> --------------------
>
>
>
> in the above code i want to give the result of select statement to a
> lable1, but i failed
>
> if anyone know that, then pls help me
>
>
>
> --
> GO and LEAD from Whereever You are.
> Think Big and Think Fast.
>
>
>


-- 
Regards
Jay Dan

Reply via email to