Help - Datagrid Populating Function

  • Thread starter Thread starter Mike Fellows
  • Start date Start date
M

Mike Fellows

ive written the function below

Function LeadReceivedNoMortgageSourced(ByVal Datagrid As
System.Web.UI.WebControls.DataGrid)
Dim conn As New System.Data.SqlClient.SqlConnection(SQLstrConn)
Dim sql As String = "LeadReceivedNotMortgageSourced"
Dim da As New System.Data.SqlClient.SqlDataAdapter(sql, conn)
Dim ds As DataSet = New DataSet()
da.Fill(ds)
ds.Tables(0).Columns.Item(0).ColumnName = "ID "
ds.Tables(0).Columns.Item(1).ColumnName = "Surname "
ds.Tables(0).Columns.Item(2).ColumnName = "Date Lead Received"
Datagrid.DataSource = ds.Tables(0)
Datagrid.DataBind()
Return ds.Tables(0).Rows.Count
End Function

i pass the function a datagrid it populates the datagrid for me and returns
me the rowcount

the problem i have is that i am unable to format the data column (column 2)
currently the data is returned as
DD/MM/YYYY 00:00:00

i really need to take the 00:00:00 from the end of the data but i am unable
to remove them in code

The data stored within the SQL Server database does not store the 0's

Thanks in advance


Mike
 
The BoundColumn class has a DataFormatString property, which you can use to
set up your formats. If you use "d" you will get a short date pattern. You
can even do this declaratively in your aspx page.
 
Back
Top