working with datagrid

Discussion in 'ASP .Net Web Controls' started by Itsme, Sep 23, 2005.

  1. Itsme

    Itsme Guest

    Hi all,

    This is my first asp application, and I am looking for a help to
    populate a datagrid which should get populated from a sqlstring that
    calls function. The code:

    Sub FillDatagribWithRecords()
    Dim tbxstart As String = txtStartDate.Text
    Dim startdate As Date

    Dim tbxend As String = txtEndDate.Text
    Dim enddate As Date

    Dim PhoneNumber As String
    PhoneNumber = ddlPhoneNumber.SelectedValue


    'Response.Write(& ddlPhoneNumber &)


    If IsDate(tbxstart) And IsDate(tbxend) Then
    txtStartDate.Text = Format(tbxstart, "dd/mm/yyyy")
    startdate = CDate(tbxstart)

    txtEndDate.Text = Format(tbxend, "dd/mm/yyyy")
    enddate = CDate(tbxend)

    Try
    Dim gridds As DataSet
    Dim myConnection As SqlConnection
    Dim GridSelectString As String

    gridds = New DataSet
    GridSelectString = "SELECT SUBSTRING(CAST(calldate AS
    VARCHAR(20)), 1, 11) AS CallDate," & _
    " SUBSTRING(CAST(calldate AS
    VARCHAR(20)), 12, 13) AS CallTime," & _
    " PhoneNumber, minutes,
    calldescription, charge " & _
    " FROM
    voipcalls.dbo.fw_fnVOIPGetCustCallHistory('" & PhoneNumber & "', " & _
    "'" & startdate & "', '" &
    enddate & "', 0, -1)"
    Response.Write("PhoneNumber")

    myConnection = New
    SqlConnection("Server=192.168.225.8;Database=Wiband;uid=Wiband;password=optiplex")
    myConnection.Open()
    Dim GridDA As New SqlDataAdapter(GridSelectString,
    myConnection)
    GridDA.Fill(gridds, "DataGridRecords")
    myConnection.Close()
    GridDA.Dispose()
    Me.GRCallHistory.DataMember = GridSelectString
    Me.GRCallHistory.DataSource = gridds

    gridds.Dispose()

    Catch ex As Exception
    MsgBox(ex.ToString)
    End Try

    Else
    Response.Write("Please enter start date and end date")
    End If

    End Sub


    Any help would be appreciated.
    Itsme, Sep 23, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ratman
    Replies:
    0
    Views:
    638
    Ratman
    Sep 14, 2004
  2. Martin Heuckeroth
    Replies:
    5
    Views:
    662
    JiangZemin
    Apr 1, 2005
  3. Alan Silver
    Replies:
    1
    Views:
    3,740
    Alan Silver
    Aug 2, 2005
  4. gaurav tyagi
    Replies:
    14
    Views:
    1,303
    gaurav tyagi
    Jan 20, 2006
  5. Andreas Klemt
    Replies:
    0
    Views:
    260
    Andreas Klemt
    Oct 8, 2003
Loading...

Share This Page