Stored procedure: column or parameter error

R

riaz.hasani

Hi every1, I'm getting this error.
I've checked my db (SQL Server) & that's the type I'm using.
In the db the column's data type is "smalldatetime".
Any suggestion 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
</Error>
 
W

William F. Robertson, Jr.

Would you post your SqlCommand code? You just go straight into the binding.

Do you have something like:

myCommand.Parameters.Add( "@Date", SqlDbType.SmallDateTime, 8 ).Value =
"1/1/2001"

You can not specify a size when using SmallDateTime.

If you don't have this, you will need to post some more of your code.

bill
 

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

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top