Home » C++ Programming

Argument of type 'const char*' is incompatible with parameter of type 'char*'

What does this error mean and how can I solve it? 

"argument of type 'const char*' is incompatible with parameter of type 'char*'"

I have a C++ method defined as void DoSomething(char* data)

and I'm trying to call it like this: DoSomething("Hello " + UserName);



7 Answers Found


Answer 1

>I have a C++ method defined as void DoSomething(char* data)
>I'm trying to call it like this: DoSomething("Hello " + UserName);

That won't work for starters: You can't join C strings together
using the plus operator.

>"argument of type 'const char*' is incompatible with
>parameter of type 'char*'"
>What does this error mean ...?

What it says. Look up the error in the compiler's help.
You're trying to pass a pointer to const char to a
function which expects a pointer to char (non-const).

- Wayne


Answer 2

I don't understand.  I'm new to C++ and I'm trying to follow an example.  Can you give an example of how to solve this in the function call? - I can't change the function definition.

Answer 3

Tthe problem you described is no C++ problem, it is a normal C problem. You can try this for example:


char buffer[80]; // a 80 character buffer


strcpy(buffer, "Hello ");
strcat(buffer, UserName);



Answer 4

Hello DeveloperPerson :D

when I saw you're question I remembered the times when I was writing my first C++ programs and always forgot to use " using namespace std" :D

back to the problem.

"argument of type 'const char*' is incompatible with parameter of type 'char*'"

In general when you get a problem like this it means that you are trying to put a parameter of a type (in this case "const char*" ) that is incompatible or not convertible to the parameter type the function is expecting . So you're function ( DoSomething(char* data) ) is expecting char* and you pas to it  "Hello " + UserName whichis const char*.

In C/C++ a string like "Hello" has the type of const char* so you can't directly use it for a char* parameter. You ca although do a cast like DoSomething((char*)"Hello"));

And as it was already written you can not concat 2 char* strings using +.   Use std::string ( #include<string> ) if you want to do something like:


using namespace std;



string userName = "XYZ";

string str = "hello" + userName;


Answer 5

Just a few additional things you need to become familiar with -

Avram F has shown you how you can create a C++ string object
and add to it by using the plus operator. However since your
function expects a pointer to char (char *) it will not accept
a C++ string object, whether passed by value, reference or

C++ string objects have a member function which allows you
to return a C-style string pointer (char *) to the data in
the C++ string object:

string userName = "XYZ";

printf("%s\n", userName.c_str());

However, note that the string returned should always be
treated as if it were a const char * and should never
be written to via the pointer returned. This can corrupt
the string object's internals. Always use the string class
methods provided for altering the data in the string

The C++ String Class

Lesson 9: C Strings

- Wayne


Answer 6

Thanks.  These responses helped a lot!

Answer 7

What does this error mean and how can I solve it? 

"argument of type 'const char*' is incompatible with parameter of type 'char*'"

I have a C++ method defined as void DoSomething(char* data)

and I'm trying to call it like this: DoSomething("Hello " + UserName);


Ignoring the other problems with your argument expression, "Hello" is a string literal.  The language definition does not allow you to modify string literals.  (Otherwise, attempting to use the same literal in another part of your function would produce undesirable results.)  Consequently, the array holding the literal has the const qualifier as part of its type.  When you pass an array like this to a function, the array expression is converted to the address of the first element with type pointer to element type.  Since your array is const char[], each element has type const char.  Therefore the expression has type const char*.  Your function is expecting a (non-const) char*.  As such it would be legal for the function to change the contents of the elements of the array.  But that is not allowed when the the array is a const.  The net result is that there is no implicit conversion from (pointer to const) to (pointer).  The compiler is telling you that you are not allowed to pass a const array to a function which might try to modify that array.

It does not matter whether your function actually alters the array, only that it might.  If your function never alters the array, then you can declare it with a const parameter and your call will work.  (Incidentally, the call will work even if the array is not const becasue there is an implicit conversion from (pointer) to (pointer to const) since it is not a problem to pass a modifiable array to a function that will not modify it.)  On the other hand, if your funciton can modify the array, you need to copy the const array to an array you can modify and pass this copy to your function.



((CFrameWnd*)m_pMainWnd)->Create(NULL,"Serialization Application" ,WS_OVERLAPPEDWINDOW,CFrameWnd::rectDefault ,NULL,(LPCTSTR)IDR_MENU1);

WHEN I Am using the above code i am getting

the below error  -- 

cannot convert parameter 2 from 'const char [26]' to 'LPCTSTR'

how to resolve this..? I want to use unicode only. here  

IDR_MENU1 is a number . and create function expects UINT


i am a student and i am trying to write a battleship game program.

at the beginning i define a three dimensional array called board[31][31][2] as the array to store the data for the game board

first i initialize the board array like this:

//Initialize board to default "x"

for(int x = 1;x<=2;x++){

	for(int y = 1;y<=bh;y++){

		for(int z=1;z<=bw;z++){

			board[y][z][x] = "x";



and then later i try to change some of the values to different letters that the computer will interpret as things

such as missed firing attempts, hits to opponent, hits to self by opponent, ships, and free spaces

i try to change it like this:


board[x][y][a] = 's'

but it says,

"Error no conversion from char to char[2]"



in a c (not c++) program, I want to say the following thing:

unsignedchar* x="test";

It gives me an error that it can't convert a const char* to an unsigned char*, so how can I tell VC++ 2010 to use unsigned char* instead of const char*?

It is a very simple program to run on a microcontroller, so I don't want to include huge libraries for conversion.

And is there any way to tell VC++ to use c as default and not c++, so that I don't have to change the extensions every time?


If you can't read this, don't complain, when I posted it, it totally, er, messed up.

I'm new to C++ as my name implies, and I have a question. The book I'm reading, doesn't hit char variables until basicly the last chapter. I'd read that chapter, but its so confusing if you skip half the book. Well, I was making a program just to make my life a little easier, its basic, but the one issue I'm having is strings, or char. In my class, I wrote this:

char title; 

as a private variable. There are two functions in the class (public) to read and write to it:

char GetTitle();

void SetTitle(char titlePer);

Now, in the constructor, I want to set a title to it, so it always has a title. The constructor has this line:

 title = "title";

The compiler gets mad at this line and says:


error C2440: '=' : cannot convert from 'const char [5]' to 'char'

1> There is no context in which this conversion is possible

What do I change to stop this?


please give me a answer of this question immediatlty i am specifing parameter second size_t then it gives assertion failure message

Hi I am converting one of my project from vc6 to vc9, in that I use CMultiDocTemplate::OpenDocumentFile(char const *,int), passing document name. I was working fine in previous version but now generating Assertion Failed error in vc9. I debug further into the code and find out that there is function called AfxFullPath [doccore.cpp] in CDocument::SetPathName that returns false, in vc6 that function not returns anything, also if I skip that assertion code then working okay. Please help me.


I'm trying to display a Message box, with the text being a string from an array, but it's giving me an error.

Any ideas?
Why expression const char *str = +"str"; is correct, but const char *str = -"str"; isn't ?

// Code Stuff

char szDrive[ MAX_PATH ];

char szDir[ MAX_PATH ];

char szFile[ MAX_PATH ];

char szExt[ MAX_PATH ];

CString csFile;

// The bellow function is correct in vc++ 6.0

_splitpath( csFile, szDrive, szDir, szFile, szExt );

// The same function is not correct in vs 2005

_splitpath( csFile, szDrive, szDir, szFile, szExt );

// Error report

error C2664: '_splitpath' : cannot convert parameter 1 from 'CString' to 'const char *'

No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called



const char* username = buf;
free( buf );

    fstream fin;
    fin.open(x );

I need to know how could I join username with .txt at my win app


How to convert  const char *  to  LPTSTR
PublicSharedFunction UrlTokenDecode(ByVal input AsString) AsByte()
  If (input IsNothing) ThenThrowNew ArgumentNullException("input")
  EndIfDim length AsInteger = input.Length
  If (length < 1) ThenReturnNewByte(0 - 1) {}
  EndIfDim num2 AsInteger = input.Chars((length - 1)) - "0"c
  If ((num2 < 0) OrElse (num2 > 10)) ThenReturnNothingEndIfDim inArray AsChar() = NewChar(((length - 1) + num2) - 1) {}
  Dim i AsIntegerFor i = 0 To (length - 1) - 1
   Dim ch AsChar = input.Chars(i)
   SelectCase ch
     inArray(i) = "+"c
     inArray(i) = "/"c
     inArray(i) = ch
     ExitSelectEndSelectNext i
  Dim j AsIntegerFor j = (length - 1) To inArray.Length - 1
   inArray(j) = "="c
  Next j
  Return Convert.FromBase64CharArray(inArray, 0, inArray.Length)

In the code above I'm trying to write a method for UrlTokenDecode for .net 1.1

But I keep getting this error "operator '-' is not defined for types 'char and 'char'" 

Does anyone know a solution for this.


I'm working with visual studio 2008 and a sql server express database. I've written some VB code behind and a stored procedure to retrieve data from the DB with multiple selections from a Listbox. I'm getting the following error which appears to be a problem passing 'myString' the list of selected items from the listbox, to the SP. The process works the first time I execute, but when I go back to the list box and select additional records, I get this error...

Procedure or function usp_itemReport has too many arguments specified.


Code Behind:

        Dim numItems As Integer
        Dim numSelected As Array

        Dim myString As String
        myString = ""

        numSelected = ListBox1.GetSelectedIndices()    ' Index of items selected in box
        numItems = ListBox1.Items.Count                      ' Number of items in List box

        Dim li As ListItem

        For Each li In ListBox1.Items
            If li.Selected = True Then
                If myString = "" Then
                    myString = li.Value
                    myString = myString & ", " & li.Value
                End If
            End If
        ' Build connection to the DB and query for the records.

        itemDataSource.ConnectionString = ConfigurationManager.ConnectionStrings("garrgrpConnectionString").ToString()

        itemDataSource.SelectCommandType = SqlDataSourceCommandType.StoredProcedure
        itemDataSource.SelectCommand = "usp_itemReport"                                     ' Call stored procedure

        'Establishes value of Primary key list sent to STORED PROCEDURE 
        itemDataSource.SelectParameters.Add("keyIds", myString)

        GridView2.DataSource = itemDataSource



Stored Proc:

ALTER PROCEDURE usp_itemReport

@keyIds varchar(300)

DECLARE @sql varchar(max);   
SET @sql = 'SELECT * FROM item AS s WHERE keyID IN ('+ @keyIds +')';    
EXECUTE (@sql);   
















Hello There,

i'm getting an error as

"Argument data type varchar is invalid for argument 2 of substring function."

When running below code

Update Broker_work_db.dbo.FIXSET"T&" =CHARINDEX('&',[Titile]),"S&" =CHARINDEX('&',[surname]),"I&" =CHARINDEX('&',[initials]),T1 =LTrim(RTRIM((Left([Titile],CHARINDEX('&',[Titile])-1)))),T2 =LTrim(RTRIM(SUBSTRING([Titile],CHARINDEX('&',[Titile])+1,Len([Titile])))),S1 =LTrim(RTRIM(Left([surname],CHARINDEX('&',[surname])-1))),S2 =LTrim(RTRIM(SUBSTRING([surname],CHARINDEX('&',[surname])+1,Len([surname])))),I1 =LTrim(RTRIM(Left([initials],1))),I2 =Left(LTrim(RTRIM(SUBSTRING([initials],LTrim(RTRIM(CHARINDEX('&',[initials])+1)),2))),1)

Can you please help me out in this??



What are the differences between const int*, int * const, and const int * const?


Back to FAQ Home


When calling the generated function import method in the derived ObjectContext class, ExecuteFunction throws an exception:

The type parameter 'SSS.Models.Cycle' in ExecuteFunction is incompatible with the type 'SSS.Models.Cycle' returned by the function. 

I tried modifying the generated ExecuteFunction as such

returnbase.ExecuteFunction<Cycle>("GetCycles", MergeOption.NoTracking, cycle_IdParameter);
but that didn't do the trick.  Incidently, Cycle is a complex type and not an entity type in the model, however I don't see this as an issue because all POCO objects are the same.


hi to all .thank in advance  ..i am using sql server .i want insert below xml into one column in table which is xml data type 
but i am getting error Operand type clash: xml is incompatible with text .pls tell me solution for this ?
<Message xmlns="http://www.abcscripts.com/messaging"><Header><To>mailto:6033168728001.spi@abcscripts.com</To><From>mailto:9900007.ncpdp@abcscripts.com</From><MessageID>541481b182404a3ea819f0aba886e652</MessageID><RelatesToMessageID/><SentTime>2010-08-23T18:27:28.2Z</SentTime></Header><Body><RefillRequest><RxReferenceNumber>163U067PL4E5LYK0D1EGXTA57JUW5HCFQ4B</RxReferenceNumber><Pharmacy><Identification><NCPDPID>9900007</NCPDPID><FileID>TW1FKB1P1H2P468L3L7RM812GR7X5O70VQ3</FileID><StateLicenseNumber>5602NPPQGU765FX7262US8X6G18NMG67H47</StateLicenseNumber></Identification><StoreName>Druglix</StoreName><Pharmacist><LastName>Pharmacist last name goes here noww</LastName><FirstName>Pharmacist First  name goes in here</FirstName><MiddleName>Pharmacist Middle name goes here</MiddleName><Suffix>Junior iii</Suffix><Prefix>Pharmacist</Prefix></Pharmacist><PharmacistAgent><LastName>Pharmacist agent Last name goes  in</LastName><FirstName>Pharmacist agent First name goes in</FirstName><MiddleName>Pharmacist agent Middle name goesin</MiddleName><Suffix>Junior iii</Suffix><Prefix>Pharmacist</Prefix></PharmacistAgent><Address><AddressLine1>333 SR 566</AddressLine1><AddressLine2>Ste 200</AddressLine2><City>Minneapolis</City><State>MN</State><ZipCode>55401</ZipCode></Address><Email>Pharmacistagent@pharmacypharmacypharmacypharmacypharmacypharmacypharmacyphar.com</Email><PhoneNumbers><Phone><Number>4015633390</Number><Qualifier>TE</Qualifier></Phone><Phone><Number>4016668888</Number><Qualifier>FX</Qualifier></Phone><Phone><Number>7039212122x2342</Number><Qualifier>BN</Qualifier></Phone><Phone><Number>7039212123x2343</Number><Qualifier>HP</Qualifier></Phone><Phone><Number>7039212124x2344</Number><Qualifier>HP</Qualifier></Phone><Phone><Number>7039212125x2345</Number><Qualifier>NP</Qualifier></Phone><Phone><Number>7039212126x2346</Number><Qualifier>CP</Qualifier></Phone><Phone><Number>7039212127x2347</Number><Qualifier>TE</Qualifier></Phone></PhoneNumbers></Pharmacy><Prescriber><Identification><SPI>6033168728001</SPI><StateLicenseNumber>A70L70O1T16IB6P2AQ38MS0B2LVM1K11S1N</StateLicenseNumber><FileID>QWM866L361U6P775P5W2TX1IE0XJ8PP8DCO</FileID></Identification><ClinicName>The prescribers Clinic for patients</ClinicName><Name><LastName>James Max bond James Max bond</LastName><FirstName>Mat Hardy Mat Hardy Mat Hardy</FirstName><MiddleName>Mathews Mathews Mathews Mathews</MiddleName><Suffix>Junior iii</Suffix><Prefix>Prescriber</Prefix></Name><Specialty><Qualifier>AM</Qualifier><SpecialtyCode>OCC</SpecialtyCode></Specialty><PrescriberAgent><LastName>Prescriber agent Last name goes now</LastName><FirstName>Prescriber agent First name goes in</FirstName><MiddleName>Prescriber agent middle name goesin</MiddleName><Suffix>Junior iii</Suffix><Prefix>Nurse12345</Prefix></PrescriberAgent><Address><AddressLine1>main street washington</AddressLine1><AddressLine2>APT 205</AddressLine2><City>Washington</City><State>AK</State><ZipCode>46466</ZipCode></Address><Email>prescriberprescriberprescriber@prescriberprescriberprescriberprescriber.com</Email><PhoneNumbers><Phone><Number>9856467876X4545</Number><Qualifier>TE</Qualifier></Phone><Phone><Number>4697879745</Number><Qualifier>FX</Qualifier></Phone><Phone><Number>7145652586X2563</Number><Qualifier>WP</Qualifier></Phone><Phone><Number>7146562563</Number><Qualifier>CP</Qualifier></Phone><Phone><Number>7031234564x55554</Number><Qualifier>TE</Qualifier></Phone><Phone><Number>7031234565x55555</Number><Qualifier>BN</Qualifier></Phone><Phone><Number>7031234566x55556</Number><Qualifier>TE</Qualifier></Phone><Phone><Number>7031234567x55557</Number><Qualifier>BN</Qualifier></Phone></PhoneNumbers></Prescriber><Supervisor><Identification><SPI>6033168728001</SPI><FileID>R52FQB6KAJL7320BX8E3D308G4K7MDD8TO7</FileID><StateLicenseNumber>KK416IH02WE6543QW0O343Y1PU87240UJ7Q</StateLicenseNumber></Identification><ClinicName>This is the supervisors clinic 1234</ClinicName><Name><LastName>Supervisor Last name goes in hereII</LastName><FirstName>Supervisor First Name Goes here now</FirstName><MiddleName>Supervisor Middle Name goes in here</MiddleName><Suffix>Suffix 123</Suffix><Prefix>Supervisor</Prefix></Name><Specialty><Qualifier>AM</Qualifier><SpecialtyCode>OTR</SpecialtyCode></Specialty><PrescriberAgent><LastName>Supervisor agent Last name goeshere</LastName><FirstName>Supervisor agent First name goes in</FirstName><MiddleName>Supervisor agent middle name goesin</MiddleName><Suffix>Junior iii</Suffix><Prefix>Supervisor</Prefix></PrescriberAgent><Address><AddressLine1>Supervisor address line 1 goes here</AddressLine1><AddressLine2>Supervisor address line 2 goes here</AddressLine2><City>Supervisor city name goes inthis pl</City><State>VA</State><ZipCode>803695432</ZipCode></Address><Email>Supervisoremailaddress@emailemailemailemailemailemailemailemailemailemailema.com</Email><PhoneNumbers><Phone><Number>01141222123456789x1234567</Number><Qualifier>HP</Qualifier></Phone><Phone><Number>7032224441x1231</Number><Qualifier>NP</Qualifier></Phone><Phone><Number>7032224442x1232</Number><Qualifier>BN</Qualifier></Phone><Phone><Number>7032224443x1233</Number><Qualifier>CP</Qualifier></Phone><Phone><Number>7032224444x1234</Number><Qualifier>CP</Qualifier></Phone><Phone><Number>7032224445x1235</Number><Qualifier>NP</Qualifier></Phone><Phone><Number>7032224446x1236</Number><Qualifier>CP</Qualifier></Phone><Phone><Number>7032224447x1237</Number><Qualifier>HP</Qualifier></Phone></PhoneNumbers></Supervisor><Patient><Identification><FileID>U801OQG2PQ7X3L3QO6VQDHT328E15W17DS4</FileID><MedicareNumber>OT486OY8YO6P7GY0L84N1676L05RMA7P8CC</MedicareNumber></Identification><Name><LastName>Pt Last name is Deerfield Brylawsky</LastName><FirstName>First name is John from Alexandriaa</FirstName><MiddleName>Middle name is Jack from Alexandria</MiddleName><Suffix>Junior iii</Suffix><Prefix>Patient II</Prefix></Name><Gender>F</Gender><DateOfBirth>19840101</DateOfBirth><Address><AddressLine1>Patient address line 1 goes in here</AddressLine1><AddressLine2>Patient address line 2 goes in here</AddressLine2><City>Patient city name goes inthis place</City><State>CO</State><ZipCode>803615977</ZipCode></Address><Email>patientemailaddress@emailemailemailemailemailemailemailemailemailemailemaile.com</Email><PhoneNumbers><Phone><Number>57192121221234567890x4444</Number><Qualifier>NP</Qualifier></Phone><Phone><Number>7034445522x4472</Number><Qualifier>HP</Qualifier></Phone><Phone><Number>7034445523x4473</Number><Qualifier>NP</Qualifier></Phone><Phone><Number>7034445524x4474</Number><Qualifier>NP</Qualifier></Phone><Phone><Number>7034445525x4475</Number><Qualifier>BN</Qualifier></Phone><Phone><Number>7034445526x4476</Number><Qualifier>NP</Qualifier></Phone><Phone><Number>7034445527x4477</Number><Qualifier>HP</Qualifier></Phone><Phone><Number>7034445528x4478</Number><Qualifier>FX</Qualifier></Phone></PhoneNumbers></Patient><MedicationPrescribed><DrugDescription>Amoxicillin-Pot Clavulanate 200 mg-28.5 mg Chewable Tablet (AMOXICILLIN TRIHYDRATE/POTASSIUM CLAVULANATE)</DrugDescription><DrugCoded><ProductCode>00093227034</ProductCode><ProductCodeQualifier>ND</ProductCodeQualifier></DrugCoded><Quantity><Qualifier>U2</Qualifier><Value>55.012345678910</Value></Quantity><DaysSupply>999</DaysSupply><Directions>Please take one chewable tablet every day in the morning during breakfast with plenty of milk. Take one tablet at night before going to bed.</Directions><Note>THIS IS A TEST MESSAGE PLEASE DISREGARD, THIS IS A TEST MESSAGE PLEASE DISREGARD. THIS IS A TEST MESSAGE PLEASE DISREGARD. THIS IS A TEST MESSAGE PLEASE DISREGARD.  TESTING MAX LENGTH OF CHARACTERS IN THE NOTES</Note><Refills><Qualifier>R</Qualifier><Quantity>99</Quantity></Refills><Substitutions>0</Substitutions><WrittenDate>20100101</WrittenDate><LastFillDate>20100525</LastFillDate><Diagnosis><ClinicalInformationQualifier>PrescriberSupplied</ClinicalInformationQualifier><Primary><Qualifier>ICD-9</Qualifier><Value>303EV41V31Q52WU6S</Value></Primary><Secondary><Qualifier>ICD-9</Qualifier><Value>456HC48O73A13HS8Y</Value></Secondary></Diagnosis><Diagnosis><ClinicalInformationQualifier>PrescriberSupplied</ClinicalInformationQualifier><Primary><Qualifier>ICD-9</Qualifier><Value>146DO81O08M03FL0R</Value></Primary><Secondary><Qualifier>ICD-9</Qualifier><Value>688JL30F24W70IH2B</Value></Secondary></Diagnosis><PriorAuthorization><Qualifier>G1</Qualifier><Value>S1IIN888TFV62FK6P2CGT4R7CCCM6083DF0</Value></PriorAuthorization></MedicationPrescribed></RefillRequest></Body></Message>



On the following query I keep getting the error 'The data types varchar and date are incompatible in the add operator'.  As you can see I have tried to convert the date but doesn't seem to work.  The variable @Date1 will start off as a date.  Any suggestions?


declare @Date1 date
declare @SQL1 varchar(2000)
set @Date1 = convert(varchar, cast(getdate() as date), 102)
set @SQL1 = 'select * from tbl_1 where convert(varchar,cast(tbl_1.Current_dt as date),102) = '+@Date1+''
print @SQL1




in sql2005 how to add a hex string to an image field.here imageHx is image field and @ImgHex is nvarchar(max) field.

i am getting error like

perand type clash: nvarchar(max) is incompatible with image

update #TmpCamRep set ImageHX=(@ImgHex)


I have a JSON response that has a parameter that can be multiple types based on the data type being returned.

For example:


"name" : "BufferPoints",
"displayName" : "BufferPoints",
"category" : "",
"helpUrl" : "",
"executionType": "esriExecutionTypeAsynchronous",
"parameters": [
  "name" : "Input_Points",
  "dataType" : "GPFeatureRecordSetLayer",
  "displayName" : "Input Points",
  "direction" : "esriGPParameterDirectionInput",
  "defaultValue" : {
    "geometryType" : "esriGeometryPoint",  
    "spatialReference" : {"wkid" : 4326},
    "fields" : [
      {"name" : "FID", "type" : "esriFieldTypeOID"},
      {"name" : "Shape", "type" : "esriFieldTypeGeometry"},
      {"name" : "Id", "type" : "esriFieldTypeInteger"}
  "parameterType" : "esriGPParameterTypeRequired",
  "category" : "",
  "choiceList" : []
  "name" : "Distance",
  "dataType" : "GPLinearUnit",
  "displayName" : "Distance",
  "direction" : "esriGPParameterDirectionInput",
  "defaultValue" : { "distance" : 100.0, "units" : "esriMiles" TaskTask},
  "parameterType" : "esriGPParameterTypeRequired",
  "category" : "",
  "choiceList" : []
  "name" : "Input_Points_By_Ref",
  "dataType" : "GPString",
  "displayName" : "Input Points By Ref",
  "direction" : "esriGPParameterDirectionInput",
  "defaultValue" : "fourptsinacol",
  "parameterType" : "esriGPParameterTypeRequired",
  "category" : "",
  "choiceList" : [
  "name" : "Output_Buffered_Points",
  "dataType" : "GPFeatureRecordSetLayer",
  "displayName" : "Output Buffered Points",
  "direction" : "esriGPParameterDirectionOutput",
  "defaultValue" : {
    "geometryType" : "esriGeometryPoint",  
    "spatialReference" : {"wkid" : 4326},
    "fields" : [
      {"name" : "FID", "type" : "esriFieldTypeOID"},
      {"name" : "Shape", "type" : "esriFieldTypeGeometry"},
      {"name" : "Id", "type" : "esriFieldTypeInteger"}
      {"name" : "Name", "type" : "esriFieldTypeString"}
  "parameterType" : "esriGPParameterTypeRequired",
  "category" : "",
  "choiceList" : []

You'll notice that the defaultValue parameter is a varying type.  How do you handle that?





<< Previous      Next >>

Microsoft   |   Windows   |   Visual Studio   |   Sharepoint   |   Azure