No data in datagrid column

  • Thread starter Thread starter Paul Evans
  • Start date Start date
P

Paul Evans

Hi,

Could anyone help me?

I'm trying to create a datagrid using the following code. It works fine
except the coloum that is supposed to display the entrydate is blank. All
the other information displays correctly.

<%@ Import Namespace="System.Data.SqlClient" %>

<Script Runat="Server">

Sub Page_Load
Dim condb112944995 As SqlConnection
Dim cmdSelect As SqlCommand

condb112944995 = New SqlConnection(
"Server=************************;UID=************;PWD=********;Database=***********"
)
cmdSelect = New SqlCommand( "Select u_id, u_manuscripttitle,
u_manuscriptauthor, u_genre, u_wordcount, u_critiquecount, u_entrydate From
ManuscriptList", condb112944995 )
condb112944995.Open()
dgrdUserList.DataSource = cmdSelect.ExecuteReader()
dgrdUserList.DataBind()
condb112944995.Close()
End Sub

</Script>



I used the following code to create the table on the SQL server.

CREATE TABLE ManuscriptList
(
u_id INT NOT NULL IDENTITY,
u_manuscripttitle VARCHAR( 100 ),
u_manuscriptauthor VARCHAR( 100 ),
u_genre VARCHAR( 100 ),
u_wordcount VARCHAR( 100 ),
u_critiquecount VARCHAR( 100 ),
u_entrydate DATETIME Default getDate()
)


Is the problem something to do with the last line [i.e. u_entrydate DATETIME
Default getDate()] or is it something to do with the ASP.NET code?

Thanks for your time

Paul Evans
 
hi,

you haven't send some sample data in the DB.
if the database don't have a value, the column in the datagrid is blank.
then the problem is in INSERT.

so try to send getdate() from the SQL.

INSERT INTO table1 values ('aaa', 'bbb'.... , getdate())"

hope this helps,
CMA
 
Back
Top