Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataGrid/DataView missing first record

Status
Not open for further replies.

cossiboon

Programmer
Dec 12, 2000
25
US
I'm fairly new to the .Net world, but have plenty of experience in ADO, VB 6, ASP and SQL.

I'm creating a page that lists user in an email list.
In asp.net using ADO.NET, I've created the SQL statement, SQLDataAdapter, dataset and created a dataview of the list. Then bound the columns appropiately to a datagrid web server control.

Looks great! The sort and filtering work wonderfully and 100 times quicker than ASP with SQL...
Problem is that the first record is not listed in the datagrid.

any ideas?


There is too much code to post, but let me know if it would help.
 
Can you paste some of your code so we can look at it?

DotNetDoc
M.C.S.D.
---------------------------------------

Tell me and I forget. Show me and I remember. Involve me and I understand.
- Anonymous Chinese Proverb
-----------------------------------
If you can't explain it simply, you don't understand it well enough.
- A. Einstein
 
'-----------------------------
'Setup the SELECT Command for email list
'-----------------------------

sSql = "SELECT user_tbl.user_id as uid, user_tbl.*, opt_out_tbl.email_address_vc as opt_out_address, psi_tbl.user_id as assignedtosurvey " & _
"FROM user_tbl INNER JOIN " & _
" List_User_Mem_Tbl ON user_tbl.user_id = List_User_Mem_Tbl.User_ID " & _
" LEFT OUTER JOIN participant_survey_index_tbl as psi_tbl " & _
" ON psi_tbl.survey_id = " & lonSurveyID & " and psi_tbl.user_id = List_User_Mem_Tbl.User_ID " & _
" left outer JOIN " & _
" opt_out_tbl ON user_tbl.email_address_vc = opt_out_tbl.email_address_vc " & _
"WHERE (dbo.List_User_Mem_Tbl.List_ID = " & lonListID & ")"

oSelCmd = New SqlCommand(sSql, cnn) 'Create command object
oSelCmd.CommandType = CommandType.Text 'Declare command type
daEmailList.SelectCommand = oSelCmd 'set command to data adapter
daEmailList.Fill(dst, "EMAIL_LIST_INDEX")

' Create a new DataView.
dvUserList = CreateDataSet().Tables("EMAIL_LIST_INDEX").DefaultView


dvUserList.RowFilter = ""

Dim drwv As DataRowView
Dim i As Int32
i = 0
For Each drwv In dvUserList
drwv("RowID") = i
i += 1
Next

With grdUsers
.DataSource = dvUserList
.DataBind()
End With


The sql statement produces the correct results in Query Analyzer. All it does is select users assigned to a survey.
Still stuck. Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top