Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

insert into table

Posted on 2013-10-25
5
414 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

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.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
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.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

856 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