G
Guest
Hi Folks I got a strange Error when executing a Stored Procedure, can Somebody help me
This is my Error Message
Server Error in '/OMAS' 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:
Line 333:
Line 334: // Finally, execute the comman
Line 335: int retval = cmd.ExecuteNonQuery()
Line 336:
Line 337: // Detach the SqlParameters from the command object, so they can be used agai
Source File: d:\inetpub\wwwroot\OMAS\SQLHelper.cs Line: 335
Stack Trace:
[InvalidCastException: Object must implement IConvertible.
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream
System.Data.SqlClient.SqlCommand.ExecuteNonQuery(
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(SqlConnection connection, CommandType commandType, String commandText, SqlParameter[] commandParameters) in d:\inetpub\wwwroot\OMAS\SQLHelper.cs:33
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters) in d:\inetpub\wwwroot\OMAS\SQLHelper.cs:25
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, String spName, Object[] parameterValues) in d:\inetpub\wwwroot\OMAS\SQLHelper.cs:28
OMAS.IO.Button1_ServerClick(Object sender, EventArgs e) in d:\inetpub\wwwroot\omas\io.aspx.cs:10
System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs e
System.Web.UI.HtmlControls.HtmlInputButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData
System.Web.UI.Page.ProcessRequestMain(
-------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
And this is my Code:
Guid FileName = Guid.NewGuid()
String GuidS = "{" + FileName.ToString() +"}"
String SaveAs = "E:\\Stacks\\" + FileName.ToString()
File.SaveAs(SaveAs)
FileIO myIO = new Dickenbestimmung.FileIO()
int[] resolution
float[] length
resolution = new int[] {0,0,0,0}
length = new float[] {0,0,0,0 }
int canFloat = myIO.dbl_read(SaveAs,ref resolution,ref length)
double[] bits = (double[]) myIO.data
//Works fine! The Data is in the Array like it should be
//Create procedure paramete
object[] obj = new object[5];
obj[0] = bits
obj[1] = Name.Text
obj[2] = SaveAs
obj[3] = GuidS
obj[4] = resolution[0]
SqlHelper.ExecuteNonQuery(connectionString,"sp_add_stack",obj);
What is wrong here? Some Problem with the "image" Data Type
Ah, this is the Code of my Procedure sp_add_stack
CREATE PROCEDURE sp_add_stac
@Data image
@name nvarchar(50)
@FileName nvarchar(50)
@StackID uniqueidentifier
@XRes in
) A
insert into StackData (Data,stackname,StackID,XRes) values(@Data,@name,@StackID,@XRes
G
This is my Error Message
Server Error in '/OMAS' 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:
Line 333:
Line 334: // Finally, execute the comman
Line 335: int retval = cmd.ExecuteNonQuery()
Line 336:
Line 337: // Detach the SqlParameters from the command object, so they can be used agai
Source File: d:\inetpub\wwwroot\OMAS\SQLHelper.cs Line: 335
Stack Trace:
[InvalidCastException: Object must implement IConvertible.
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream
System.Data.SqlClient.SqlCommand.ExecuteNonQuery(
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(SqlConnection connection, CommandType commandType, String commandText, SqlParameter[] commandParameters) in d:\inetpub\wwwroot\OMAS\SQLHelper.cs:33
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters) in d:\inetpub\wwwroot\OMAS\SQLHelper.cs:25
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, String spName, Object[] parameterValues) in d:\inetpub\wwwroot\OMAS\SQLHelper.cs:28
OMAS.IO.Button1_ServerClick(Object sender, EventArgs e) in d:\inetpub\wwwroot\omas\io.aspx.cs:10
System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs e
System.Web.UI.HtmlControls.HtmlInputButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData
System.Web.UI.Page.ProcessRequestMain(
-------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
And this is my Code:
Guid FileName = Guid.NewGuid()
String GuidS = "{" + FileName.ToString() +"}"
String SaveAs = "E:\\Stacks\\" + FileName.ToString()
File.SaveAs(SaveAs)
FileIO myIO = new Dickenbestimmung.FileIO()
int[] resolution
float[] length
resolution = new int[] {0,0,0,0}
length = new float[] {0,0,0,0 }
int canFloat = myIO.dbl_read(SaveAs,ref resolution,ref length)
double[] bits = (double[]) myIO.data
//Works fine! The Data is in the Array like it should be
//Create procedure paramete
object[] obj = new object[5];
obj[0] = bits
obj[1] = Name.Text
obj[2] = SaveAs
obj[3] = GuidS
obj[4] = resolution[0]
SqlHelper.ExecuteNonQuery(connectionString,"sp_add_stack",obj);
What is wrong here? Some Problem with the "image" Data Type
Ah, this is the Code of my Procedure sp_add_stack
CREATE PROCEDURE sp_add_stac
@Data image
@name nvarchar(50)
@FileName nvarchar(50)
@StackID uniqueidentifier
@XRes in
) A
insert into StackData (Data,stackname,StackID,XRes) values(@Data,@name,@StackID,@XRes
G