W
Wu
Dear All Readers,
Can somebody give me some hints or advices?
I have a table in SQL 2005 express as below:
Fieldname DataType
RecID Uniqueidentifier
Info_Type nvarchar(200)
RecStatus bit
RecStatusDT datetime
I have used the dataset named info_type.xsd with the info_typeTableAdapter.
This TableAdapter has three functios such as
1) Fill,GetData() > All data in this table
2) FillByRecID, GetDataByRecID (@recid) > Get all columns by RecID
3) InfoType_update(@recid, @info_type) > Update the Info_Type field by
RecID
#2 and #3 have the stored procedure
------------------------------------
#2 Stored procedure as below:
------------------------------------
ALTER PROCEDURE InfoType_selectByInfo_Type
(
@recid char(36)
)
AS
declare @guid char(36)
set @guid = cast(@recid as char(36))
select *
from Info_Type
where RecID = @guid
return
-------------------------------------
#3 Stored Procedure as below:
-------------------------------------
LTER PROCEDURE InfoType_update
(
@recid char(36),
@info_type nvarchar(200)
)
AS
declare @guid char(36)
set @guid = cast(@recid as char(36))
update Info_Type
set Info_Type = @info_type,
RecStatusDT = getdate()
where RecID = @guid
return
---------------------------------------------
I have a gridview in default.aspx and with edition function and show all the
above fields with DataKeyNames = RecID. However, when I clicked update,
then it shows the following error:
Server Error in '/WebSite2' Application.
--------------------------------------------------------------------------------
Object must implement IConvertible.
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.InvalidCastException: Object must implement
IConvertible.
Source Error:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.
Stack Trace:
[InvalidCastException: Object must implement IConvertible.]
System.Convert.ChangeType(Object value, TypeCode typeCode,
IFormatProvider provider) +2880621
System.Web.UI.WebControls.Parameter.GetValue(Object value, String
defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean
ignoreNullableTypeChanges) +141
System.Web.UI.WebControls.Parameter.GetValue(Object value, Boolean
ignoreNullableTypeChanges) +63
System.Web.UI.WebControls.ObjectDataSourceView.MergeDictionaries(ParameterCollection
reference, IDictionary source, IDictionary destination, String
parameterNameFormatString) +423
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteUpdate(IDictionary
keys, IDictionary values, IDictionary oldValues) +907
System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values,
IDictionary oldValues, DataSourceViewOperationCallback callback) +92
System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32
rowIndex, Boolean causesValidation) +907
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean
causesValidation, String validationGroup) +704
System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs
e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source,
EventArgs e) +123
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +118
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
eventArgument) +135
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
--------------------------------------------------------------------------------Version Information: Microsoft .NET Framework Version:2.0.50727.3053;ASP.NET Version:2.0.50727.3053Please advice me because I am a starter in Programming. Thanks.Wu
Can somebody give me some hints or advices?
I have a table in SQL 2005 express as below:
Fieldname DataType
RecID Uniqueidentifier
Info_Type nvarchar(200)
RecStatus bit
RecStatusDT datetime
I have used the dataset named info_type.xsd with the info_typeTableAdapter.
This TableAdapter has three functios such as
1) Fill,GetData() > All data in this table
2) FillByRecID, GetDataByRecID (@recid) > Get all columns by RecID
3) InfoType_update(@recid, @info_type) > Update the Info_Type field by
RecID
#2 and #3 have the stored procedure
------------------------------------
#2 Stored procedure as below:
------------------------------------
ALTER PROCEDURE InfoType_selectByInfo_Type
(
@recid char(36)
)
AS
declare @guid char(36)
set @guid = cast(@recid as char(36))
select *
from Info_Type
where RecID = @guid
return
-------------------------------------
#3 Stored Procedure as below:
-------------------------------------
LTER PROCEDURE InfoType_update
(
@recid char(36),
@info_type nvarchar(200)
)
AS
declare @guid char(36)
set @guid = cast(@recid as char(36))
update Info_Type
set Info_Type = @info_type,
RecStatusDT = getdate()
where RecID = @guid
return
---------------------------------------------
I have a gridview in default.aspx and with edition function and show all the
above fields with DataKeyNames = RecID. However, when I clicked update,
then it shows the following error:
Server Error in '/WebSite2' Application.
--------------------------------------------------------------------------------
Object must implement IConvertible.
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.InvalidCastException: Object must implement
IConvertible.
Source Error:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.
Stack Trace:
[InvalidCastException: Object must implement IConvertible.]
System.Convert.ChangeType(Object value, TypeCode typeCode,
IFormatProvider provider) +2880621
System.Web.UI.WebControls.Parameter.GetValue(Object value, String
defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean
ignoreNullableTypeChanges) +141
System.Web.UI.WebControls.Parameter.GetValue(Object value, Boolean
ignoreNullableTypeChanges) +63
System.Web.UI.WebControls.ObjectDataSourceView.MergeDictionaries(ParameterCollection
reference, IDictionary source, IDictionary destination, String
parameterNameFormatString) +423
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteUpdate(IDictionary
keys, IDictionary values, IDictionary oldValues) +907
System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values,
IDictionary oldValues, DataSourceViewOperationCallback callback) +92
System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32
rowIndex, Boolean causesValidation) +907
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean
causesValidation, String validationGroup) +704
System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs
e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source,
EventArgs e) +123
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +118
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String
eventArgument) +135
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
--------------------------------------------------------------------------------Version Information: Microsoft .NET Framework Version:2.0.50727.3053;ASP.NET Version:2.0.50727.3053Please advice me because I am a starter in Programming. Thanks.Wu