Showing posts with label accessing. Show all posts
Showing posts with label accessing. Show all posts

Friday, March 30, 2012

newbie question on accessing count(*) results

hello,
this is my sql query with access:
Dim SQLstr2 As String = "Select count(*) as total, oDate from Order_Details where oNo = " + Request("oNo") + " group by oDate"

However, problem is, I am clueless about how to access the data that is derived from my count(*).

I tried this: Response.Write(reader2("total"))

All I get is that No data exists for the row/column.

I tried not to select oDate and even took away the WHERE, but the same problem persists. Any ideas please?here's a template code that might help you.


Dim ConnectionString As String = "Your_Connection_String"
Dim CommandText As String = "select Col1, Col2, Col3 from TableName"
Dim myConnection As New System.Data.SqlClient.SqlConnection(ConnectionString)
Dim myCommand As New System.Data.SqlClient.SqlCommand(CommandText, myConnection)
myConnection.Open()

Dim DataReader As System.Data.SqlClient.SqlDataReader = myCommand.ExecuteReader()
If DataReader.HasRows Then
Do While DataReader.Read()
Response.Write(DataReader.Item("Col1"))
Response.Write(DataReader.Item("Col2"))
Response.Write("<BR>")
Loop
End If
DataReader.Close()
myconnection.close()

hth

Wednesday, March 28, 2012

Newbie Question accessing values in other data regions

Hi,
i have a simple report that has two data regions,
i want to use a calculated field in one data region that refers to a
field in the other region.
how do i achieve this?
sql server 2000 RS 2000
regardsThink of RS data regions as repeaters that expand to show all rows in the
underlying dataset. So, a data region cell is relative since its position is
known only during runtime. It is like trying to link two database tables
that don't have a common key. For this reason, you can only get an
aggregated value from another region, e.g. Sum(Fields!FieldName.Value).
--
HTH,
---
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/
---
"cg" <colingresty@.yahoo.co.uk> wrote in message
news:1131975339.742358.216470@.z14g2000cwz.googlegroups.com...
> Hi,
> i have a simple report that has two data regions,
> i want to use a calculated field in one data region that refers to a
> field in the other region.
> how do i achieve this?
> sql server 2000 RS 2000
> regards
>|||thanks Teo,
that makes things a bit clearer.