Error 102 Argument '12': cannot convert from 'ref System.Guid' to 'System.Guid?'

Hi

 I have a stored proc as follows:

USE [SubSrvs]
GO
/****** Object:  StoredProcedure [dbo].[subsrvs_Services_CreateService]    Script Date: 07/15/2007 11:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[subsrvs_Services_CreateService]
 @Level1    nvarchar(max),
    @Level2    nvarchar(max),
    @Level3    nvarchar(max),
    @Level4    nvarchar(max),
    @Level5    nvarchar(max),
    @Level6    nvarchar(max),
    @serviceName  nvarchar(max),
 @ChargeFormula  nvarchar(max), 
 @UserId    uniqueidentifier,
 @CampaignNo   uniqueidentifier,
 @ClientID   uniqueidentifier,
 @ServiceNo   uniqueidentifier OUTPUT
 
AS
BEGIN

IF( @ServiceNo IS NULL )
        SELECT @ServiceNo = NEWID()
    ELSE
    BEGIN
        IF( EXISTS( SELECT ServiceNo FROM dbo.subsrvs_Services
                    WHERE @ServiceNo = ServiceNo ) )
            RETURN -1
    END
 
    INSERT dbo.subsrvs_Services (ServiceNo, Level1, Level2, Level3, Level4, Level5, Level6, ServiceName, Chargeformula, UserId, CampaignNo, ClientId)
    VALUES (@ServiceNo, @Level1, @Level2, @Level3, @Level4, @Level5, @Level6, @ServiceName, @Chargeformula, @UserId, @CampaignNo, @ClientId)

 RETURN 0

END

 the sp returns the ServiceNo ok and inserts the correct record when I execute from SQL Server management studio, so there is no problem with the stored proc.

 I've created a table adapter that uses the CreateService sp for it's insert method and before I added the ServiceNo this worked fine too.

I've written a class that uses the TableAdapter as follows:

 [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Insert, true)]
 public bool CreateService(string Level1, string Level2, string Level3, string Level4, string Level5, string Level6, string ServiceName, string ChargeFormula, System.Guid UserId, System.Guid CampaignNo, System.Guid ClientId, Array Providers)
    {
        System.Guid ServiceNo = System.Guid.Empty;                
        using (TransactionScope ts = new TransactionScope())
        {
            int retval = Adapter.Insert(Level1, Level2, Level3, Level4, Level5, Level6, ServiceName, ChargeFormula, UserId, CampaignNo, ClientId, ServiceNo);

ts.Complete();
           
        } 
    }

 the above proc is called when the formview insert command is executed.

 The compiler error I get is Argument '12': cannot convert from 'ref System.Guid' to 'System.Guid?'

 The .xsd code for that parameter is:

<Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="Guid" Direction="InputOutput" ParameterName="@ServiceNo" Precision="0" ProviderType="UniqueIdentifier" Scale="0" Size="16" SourceColumn="ServiceNo" SourceColumnNullMapping="False" SourceVersion="Current">

I've tried all sorts of casts but cannot get the thing to compile - help pls - driving me insane!Tongue Tied
 

 

 

 

0
ninja
7/15/2007 10:55:44 AM
asp.net.getting-started 91979 articles. 4 followers. Follow

3 Replies
983 Views

Similar Articles

[PageSpeed] 44

Looks like you need to pass a nullable GUID

 System.Guid ? ServiceNo = System.Guid.Empty;


Cheers
Al
My Blog
MapStats.NET
Please click on 'Mark as Answer' if this post answered your question!
0
albertpascual
7/15/2007 2:04:51 PM

that's done it thank you for for the quick response, you've cheered my Sunday up no end Big Smile

this worked: 

System.Guid ? ServiceNo = System.Guid.Empty;
               
        using (TransactionScope ts = new TransactionScope())
        {
            int rowsAffected = Adapter.Insert(Level1, Level2, Level3, Level4, Level5, Level6, ServiceName, ChargeFormula, UserId, CampaignNo, ClientId, ref ServiceNo);

 

and onwards...Yes
 

 

0
ninja
7/15/2007 2:51:03 PM

No worries, glad I could help!

 


Cheers
Al
My Blog
MapStats.NET
Please click on 'Mark as Answer' if this post answered your question!
0
albertpascual
7/15/2007 3:02:04 PM
Reply:

Similar Artilces:

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

Cannot convert value of parameter 'Course_FK' from 'System.String' to 'System.Guid'
Hi, I'm building a site and I've been trying to accomplish something similar to what is talked about in "Working with Data in ASP.NET 2.0 :: Declarative Parameters" tutorial. Below is the code for my methods from the xsd. I tried to attach a screenshot of my xsd but for some reason I'm not allowed GetAllCourseNames() SELECT        CourseID, NameFROM            Course GetCourseScheduleByCourseID SELECT        ScheduleID, Course_FK, Date, TeeTime, NumberOfPlayersF...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

'System.String' to 'System.Guid'
 Hi Guys, I have this working with a hyperlink field in a gridview.   <asp:HyperLinkField DataNavigateUrlFields="UserID" DataNavigateUrlFormatString="userprofiles.aspx?UserID={0}" DataTextField="UserName" HeaderText="User Name" Text="User Name" >  I just want to same thing in a datagrid but I get this error:  <asp:HyperLink ID="HyperLinkToUserProfile" runat="server" NavigateUrl="userprofiles.aspx?UserID={0}"><%# Eval("UserName...

Error 17 Argument '2': cannot convert from 'System.Web.UI.WebControls.FontSize' to 'float'
Error 17 Argument '2': cannot convert from 'System.Web.UI.WebControls.FontSize' to 'float' Error 16 The best overloaded method match for 'System.Drawing.Font.Font(string, float, System.Drawing.FontStyle)' has some invalid arguments Code:chart.DrawString(Convert.ToString(barValue[i]), new Font("arial", FontSize.Small, FontStyle.Regular), TEXT_COLOR, (columnSpacing + CHART_LEFT_MARGIN), (BMP_HEIGHT - (CHART_BOTTOM_MARGIN - (currentBarHeight - BAR_LABEL_SPACE)))); Any solution? I would be grateful for any help. new Font("...

'do' won't 'do' if '/'
Greetings to All from Au, Have a NetWare Perl 5.8.4 and wanted to tweak File\Spec\NW.pm to try and standardise on '/' separators. If I run a test script (t/uni/lower.t) with an unmodified NW.pm, it calls t/uni/case.pl, that, in case.pl, (when the path separators are '\'), the $file is '..\lib\unicore\To\Lower.pl' and the following code portion works, with $simple getting a returned table: sub casetest { my ($base, $spec, $func) = @_; my $file = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "lib", &qu...

'System.String' to 'System.DateTime' error
Hi, I have a Gridview with templates and i set the format to Text='<%# Eval("PrescriptionDate", "{0:dd/MM/yyyy}") %>'  The objectDataSource: <asp:ObjectDataSource DeleteMethod="DeletePrescriptionDetails" InsertMethod="InsertPrescriptionDetails" ID="objDetails" runat="server" SelectMethod="GetAllPrescriptionDetails" UpdateMethod="UpdatePrescriptionDetails" TypeName="GridViewClasses"> <UpdateParameters> <asp:Parameter Name="PrescriptionId" Type="Int32" /> <asp:Parameter Name="MedicineId" Type="Int32" /> <asp:Parameter Name="ActualDose" Type="I...

'''
Name: L Lachowsky Email: e2brutus_10atyahoodotcom Product: Firefox Summary: ''' Comments: why duddn this surprise me... I change default server from IE to Mozilla, and then i get error messages. well, shud I decide to not get on my computer with Mozilla..or shud I risk security breeches with IE....hmmm at least i can get on the internet with IE Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this fee...

System.Net.Mail is giving error CS0029: Cannot implicitly convert type 'string' to 'System.Net.Mail.MailAddress'
I'm getting an error while trying to use the wizard to create a form and than pass it the vaibles to Mail. Any help would be much appreciated. SmtpClient smtpClient = new SmtpClient(); MailMessage message = new MailMessage(); try {   message.From = txtEmail.Text; message.To.Add("admin1@yoursite.com"); message.Subject = "Feedback"; message.CC.Add("admin1@yoursite.com"); message.CC.Add("admin2@yoursite.com"); message.IsBodyHtml = false; message.Body = txtMessage.Text; smtpClient.Send(message); lblStatus.Text = "Email successfully sent."; } catch (Exception ex) { lbl...

Cast from type ''''DBNull'''' to type ''''String'''' is not valid.
How do I avoid getting this error: Cast from type ''''DBNull'''' to type ''''String'''' is not valid. I am trying to get values from the database into a form for updating using a Datareader, SQL is set to allow nulls for certain fields as they are not required but the only way I can get the form to display is by adding a space in SQL. Is there another way around this? Check if it is equal to DBNull.Value first and if it is, don't do the cast.Stanley Tan theSpoke Blog Where in the code does it need to go? I am using the following and it's the profile that isn't always requi...

table_info('','','','%') cannot return any types
I was recently confirming table_info special cases and discovered the case for getting table_types cannot work. table_info('','','','%') should return a list of table types but it returns a list of empty strings instead: my @types = $h->tables('', '', '', '%'); print "all types:\n", join("xxx\n", @types), "\n"; # should output something like: # "dbo" # "INFORMATION_SCHEMA" # "sys" # and actually outputs: xxx xxx It seems to be down to the following ...

Convert 'System.DBNull' to type 'System.String' ?
I have a textbox on my site that I want to populate with some data, however when the value is null, which is quite often.The problem is that when I call a static method which returns a string; when that string is DBNull, I get the following error which is absolutely correct.Unable to cast object of type 'System.DBNull' to type 'System.String'.So, what should I do to be able to ignore that the string is null and just display a "" string in the texbox?The code is as follows:    private void GetCartSmall(string sSessionID)    {      &n...

Argument '1': cannot convert from 'object' to 'int'
 I am calling a function from a label control in my gridview.. <asp:Label ID="Label1" runat="server" Text='<%# ShowCategoriesForPID(Eval("pol_id")) %>'/> But i get following error when i compile -error CS1503: Argument '1': cannot convert from 'object' to 'int'  pol_id is an integer value and my function receives it as an integer argument.  I dont know whats wrong? The "Eval" function returns an object. To need to cast it's result: <asp:Label ID="Label1" runat="s...

Argument '4': cannot convert from 'string' to 'int'
im implenting a payment gateway based on webreference into a webshop im so close on finishing it, but this argument 4 error keeps on happening at the initiation of the order the following happens. the following line, gives the Payment server the data, myTransactionResponse = myWS.TransActionRequest (true, "00000", "EUR", 12345, order.OrderNumber, vk_bankid.SelectedValue, "return.aspx");  instead of 12345, there must be the dynamic order total, with shipping and tax, but we dont seem to be doing it right, because when we use the procedure ORDER.Order...

Web resources about - Error 102 Argument '12': cannot convert from 'ref System.Guid' to 'System.Guid?' - asp.net.getting-started

Resources last updated: 12/25/2015 9:57:05 PM