Link to home
Start Free TrialLog in
Avatar of dovk179
dovk179

asked on

insert into table

In mala2DataSet1.xsd

I have a select query  with the executeMod Reader, FillMethodName Fillby_Cod and GetMethodname GetDataBy_cod
in order to populate a DataGridvalue with the cod or heigher number I called:

      Me.AnuncTableAdapter.FillBy_cod(Me.Mala2DataSet1.Anunc, vcod)   and it works fine

I  have to add a row to a table named  "anunc" and populate only the codint field.
With a select query I created inside mala2DataSet1.xsd -  Anunc table -  the following query

      INSERT INTO Anunc (CODINT) VALUES(@codint) and inside the query Builder, the execute Query works well.

the name of the query is  InsertQueryCod2ann, Comand type - text, ComandMod - NonQuery, parameter name - @Codint and DBType = int32

I tried to accomplish results the same way with

       Me.AnuncTableAdapter.InsertQueryCod2ann(Me.Mala2DataSet1.Anunc, vcod)
 
The error message is:

Error      2      Value of type 'CFEMP71.mala2DataSet1.AnuncDataTable' cannot be converted to 'Integer'.      

looking for help

Thanks

Dov
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Which overloaded update method are you trying to use?  The compiler tries its best to match up parameter types, and when it can't find a match, then it complains...
>I  have to add a row to a table named  "anunc" and populate only the codint field.
>error message is:

>Error...Value of type 'CFEMP71.mala2DataSet1.AnuncDataTable' cannot be converted to 'Integer'.      

Where in the VB.NET or the SQL does it validate that the value in codint was actually an integer?  For example, if a user typed 'banana' and ran that function, and that was passed, it would return a similar error message.
Avatar of dovk179
dovk179

ASKER

Hi,
As you can see I use the wizard for this operation.
in the mala2DataSet1.xsd, table anunc, I create an insert query.

The parameter is @codigo  int 32
I check and execute the query inside the query builder.
I give a number to the value requested  and Ok it.
I receive a confirmation.  
 I verify the result in the preview data window.
Codigo 20226 appears as the last record in the  anunc Table.

I think that the error message:  AnuncDataTable' cannot be converted to 'Integer'
refers to the fact that  data table cannot be converted to an integer and that the query that I wrote - Me.AnuncTableAdapter.InsertQueryCod2ann(Me.Mala2DataSet1.Anunc, vcod) - is Wrong

Looking forward to hear from you

Dov
insert-2.gif
ASKER CERTIFIED SOLUTION
Avatar of Ark
Ark
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dovk179

ASKER

Hi,
Thanks a lot. works perfect.
Dov