Solved

insert into table

Posted on 2013-10-25
5
419 Views
Last Modified: 2013-10-27
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
0
Comment
Question by:dovk179
5 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39602672
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...
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 39602677
>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.
0
 

Author Comment

by:dovk179
ID: 39602889
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
0
 
LVL 28

Accepted Solution

by:
Ark earned 500 total points
ID: 39603382
Me.AnuncTableAdapter.InsertQueryCod2ann(vcod) 'assuming vcod is integer value for @Codint parameter
0
 

Author Closing Comment

by:dovk179
ID: 39603732
Hi,
Thanks a lot. works perfect.
Dov
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question