Column width

A

aspnetpal

Hi Every1, I'm getting this error.
'Cannot specify a column width on data type smalldatetime.'
I'm using SQL Server & I've check the data type in the db & it's same
as smalldatetime.
Any suggestions would be highly appreciated.
Thanks

<Error>

Column or parameter #8: Cannot specify a column width on data type
smalldatetime.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Column or
parameter #8: Cannot specify a column width on data type smalldatetime.

Source Error:


Line 344: Try
Line 345: myConnection.Open()
Line 346: dgdSearch.DataSource = myCommand.ExecuteReader()
Line 347: dgdSearch.DataBind()
Line 348: Finally


Source File: c:\inetpub\wwwroot\Demo Equip Log\Search Equipment.aspx.vb
Line: 346

Stack Trace:


[SqlException: Column or parameter #8: Cannot specify a column width on
data type smalldatetime.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +742
System.Data.SqlClient.SqlCommand.ExecuteReader() +41
Demo_Equip_Log.Search_Equipment.BindGrid() in
c:\inetpub\wwwroot\Demo Equip Log\Search Equipment.aspx.vb:346
Demo_Equip_Log.Search_Equipment.Page_Load(Object sender, EventArgs
e) in c:\inetpub\wwwroot\Demo Equip Log\Search Equipment.aspx.vb:195
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +750
 
A

aspnetpal

I've found the problem.
I was trying to set the width for the column in my stored procedure
like this.

ColumnName smalldatetime (4),

which is not allowed. The correct form is as follows ...

ColumnName smalldatetime,

Hope this helps. Also if you found the solution to any problem, please
post it so people can benefit from it.

Thanks
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top