2010-08-23 3 views
0

고객에게 HTML 뉴스 기사를 보내는 데 사용할 전자 메일 응용 프로그램을 작성 중입니다. 데이터 세트를 사용하여 클라이언트에게 표시 할 헤드 라인을 반환합니다. 데이터 세트를 반복 할 때 최신 레코드가 반환되지만 최신 헤드 라인 링크는 표시되지 않습니다. 따라서 출력 된 HTML은 매번 동일한 헤드 라인으로 데이터 셋의 첫 번째 레코드입니다. 데이터 세트의 다음 레코드로 이동하여 다음/올바른 헤드 라인을 표시하기 위해 출력 된 HTML을 얻으려면 어떻게해야합니까? 채우는 코드 '데이터 집합데이터 세트에서 다음 행으로 이동하여 하이퍼 링크로 표시하는 방법

Try 
     Dim objConn As SqlConnection = New SqlConnection() 
     objConn.ConnectionString = myConnectionString 
     objConn.Open() 

     ds = New DataSet 
     ds.Clear() 

     Dim sqlCommand As String = "SomeSql" 

     Dim objCmd As SqlCommand = New SqlCommand(sqlCommand, objConn) 

     Dim dataAdapter As SqlDataAdapter = New SqlDataAdapter(objCmd) 
     dataAdapter.Fill(ds)  

     Catch ex As Exception 
     MsgBox(ex.ToString) 
     GetHeadline = Nothing 
    End Try 

    Return ds 

End Function 

으로 코드 채울 데이터 세트

공공 기능 GetHeadline (정수로 ByVal의 용은 articleID)'

가 : 여기

내 코드의 샘플입니다 링크

If GroupID = 4 Then 
iLocation1 = HTMLbody.IndexOf("{!HeadlineID") 

While iLocation1 > 0 
iLocation2 = HTMLbody.IndexOf("}", iLocation1) 
sHeadLineTag = HTMLbody.Substring(iLocation1 + 1, iLocation2 - iLocation1 - 1) 
dtReport = clsGlobal.globalReportCatalog.GetHeadline2() 
clsGlobal.globalReportCatalog.SetHeadlinePropertiesFromRow(dtReport.Rows(0)) 

With clsGlobal.globalReportCatalog 
    For i As Integer = 0 To dtReport.Rows.Count 
    If i < dtReport.Rows.Count - 1 Then 
    i = i + 1 
    End If 

    Dim ID As Integer = dtReport.Rows(i)("ArticleID") 

    sHyperTag = "<a href=""" & "http://www.myweb.com/somedirectory/Login.aspx" & .HeadlineMarketingLink & """>" & .HeadlineReportName & " - " & .HeadlineTitle & "</a>" 
    sHeadlineDescription = .HeadlineDescription 

    HTMLbody = HTMLbody.Replace("{!Report.Description}", sHeadlineDescription) 

    Next 
End With 

답변

0

난 당신이

For i As Integer = 0 To dtReport.Rows.Count 
    If i < dtReport.Rows.Count - 1 Then 
    i = i + 1 
    End If 

당신이

Dim ID As Integer = dtReport.Rows(dtReport.Rows.Count - 1)("ArticleID") 

를 사용할 수 없습니다 또는 당신이 잊어 루프에서 행 MoveNext는있을했는데이 필요한 이유 표시되지 않는 이유는 무엇입니까?

관련 문제