473,756 Members | 1,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Submittiing InfoPath Data Via Webservice and ADO.NET

Hi all,

Simple question concerning infopath, webservice, and an INSERTINTO Sql command:

WARNING: All following content is NEWBIE generated and froughtwith errors (probably)

All I want to do is add a 4 column row to a SQL Server tableusing infopath, a webservice, and ADO.net.

I've tried this:
Public Function UpdateADMST(ByV al ID As String, ByVal PG AsString, ByVal LT As String, ByVal TX As String) As DataSet

Dim sqlAdamUpdate As String = "INSERT INTO ADMST (ADMAID, ADMAPG,ADMALT, ADMATX) VALUES(@ID, @PG, @LT, @TX)"

Dim cmdAdamUpdate As New SqlCommand(sqlA damUpdate, adamConn)

cmdAdamUpdate.P arameters.Add(N ewSystem.Data.S qlClient.SqlPar ameter("@ID",sy stem.Data.SqlDb Type.VarChar, 10, "ADMAID").V alue = SOME THINGI CAN"T FIGURE OUT)
cmdAdamUpdate.P arameters.Add(N ewSystem.Data.S qlClient.SqlPar ameter("@PG",Sy stem.Data.SqlDb Type.VarChar, 10, "ADMAPG"))
cmdAdamUpdate.P arameters.Add(N ewSystem.Data.S qlClient.SqlPar ameter("@LT",Sy stem.Data.SqlDb Type.VarChar, 10, "ADMALT"))
cmdAdamUpdate.P arameters.Add(N ewSystem.Data.S qlClient.SqlPar ameter("@TX",Sy stem.Data.SqlDb Type.VarChar, 10, "ADMATX"))

adamConn.Open()
cmdAdamUpdate.E xecuteNonQuery( )
adamConn.Close( )

This produces the following error:
System.Web.Serv ices.Protocols. SoapException: Server was unable toprocess request. ---> System.Data.Sql Client.SqlExcep tion:Prepared statement '(@ADMAID varchar(10),@AD MAPGvarchar(10) ,@ADMALT varchar(10),@AD ' expects parameter @ADMAID,which was not supplied.

I've Tried this:
Public Function UpdateADMST(ByV al ID As String, ByVal PG AsString, ByVal LT As String, ByVal TX As String) As DataSet

Dim ID_len As Integer = ID.Length
Dim PG_len As Integer = PG.Length
Dim LT_len As Integer = LT.Length
Dim TX_len As Integer = TX.Length

Dim adam_UpDS As New DataSet

Dim ADMST As New DataTable
adam_UpDS.Table s.Add(ADMST)

Dim ID_col As New DataColumn("ADM AID")
adam_UpDS.Table s(0).Columns.Ad d(ID_col)

Dim PG_col As New DataColumn("ADM APG")
adam_UpDS.Table s(0).Columns.Ad d(PG_col)

Dim LT_col As New DataColumn("ADM ALT")
adam_UpDS.Table s(0).Columns.Ad d(LT_col)

Dim TX_col As New DataColumn("ADM ATX")
adam_UpDS.Table s(0).Columns.Ad d(TX_col)

Dim adam_row As DataRow
adam_row = adam_UpDS.Table s(0).NewRow()

adam_row.Item(0 ) = ID.Substring(0, ID_len)
adam_UpDS.Table s(0).Rows.Add(a dam_row)

adam_row.Item(1 ) = PG.Substring(0, PG_len)
adam_UpDS.Table s(0).Rows.Add(a dam_row)

adam_row.Item(2 ) = LT.Substring(0, LT_len)
adam_UpDS.Table s(0).Rows.Add(a dam_row)

adam_row.Item(3 ) = TX.Substring(0, TX_len)
adam_UpDS.Table s(0).Rows.Add(a dam_row)

SqlDataAdapter1 .Update(adam_Up DS)

Which gives a "narrowing conversion" error.

This CANNOT be that difficult, but do you think I can find anexample anywhere??? Nope. Nope, and Nope.

Any help would be great.

Insanely Yours,
ed

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>NcPnbFY0jE+ 2oDonb4aIAg==</Id>
Nov 12 '05 #1
0 2734

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1327
by: Dr. Paul Caesar - CoullByte (UK) Limited | last post by:
Hi all, Have been playing about with web services but unable to achieve what I am wanting and in attempts finding strange problems. I have created a web service for retrieving customer data and for updating the data using datasets. I have created a XML schema. I decided to use InfoPath for testing things out. Works great for getting the data.
0
1840
by: Pascal Brunot | last post by:
Hi, Running XSDObjectGen (1.4.1.0) on the following Infopath-generated XSD gives an "unexpected error": "Event register full" during generation (exact english error message may differ, i am using the italian version). VS.net 2003 accepts the XSD. The strange thing is that I managed using XSDObjectGen on much more
4
2217
by: MJ | last post by:
A question for InfoPath and ASP.NET experts: What do you think about the future of InfoPath and ASP.NET WebForms? Is InfoPath 12 going to replace ASP.NET WebForms? If not, in which types of applications would ASP.NET WebForms be more appropriate than InfoPath and vice versa? I very much appreciate your response! Best regards, Mike Johnson
0
1246
by: Cosimo Galasso | last post by:
I'm building a aspx web page with a button control. When the button is clicked the server build an xml string containg the directive to be opened with infopath. When the client receive the file an error occured. The strange is that if a save the file locally, open with notepad and save it again without any modification, the file is correctlu opened with infopath. Any suggestion?
5
8268
by: jb | last post by:
*Please* help --- I'm tearing my hair out. I want to use sessionstate in a webservice, accessed from a client, written in script (JScript, InfoPath). I have written my webservice (C# .NET). I have marked the method(s) with EnableSession=true. I have read everything there is to read! I am told that to reuse session, my client needs to receive a cookie in the header from the webservice and then pass this back in all future calls. ...
4
2097
by: WStoreyII | last post by:
I wish to know how to set it up so that when an xml webservice is called that instead of displaying the xml in the browser it will render it with a xslt file the problem is i dont know how to do this? Thanks again WStoreyII
0
1158
by: David van der kooij | last post by:
Hi, I have a webservice that returns an xmldocument. I write some processing isntructions to this xmldocument like this XmlProcessingInstruction myPI3; PItext = "progid='InfoPath.Document'"; myPI3 = oXML.CreateProcessingInstruction("mso-application", PItext); oXML.AppendChild (myPI3);
3
4805
by: Jeff Richardson | last post by:
This is a repost from the InfoPath news group. Hi, I am writing a SharePoint application that works with InfoPath forms. When a user submits a completed InfoPath form to a forms library my code processes the posted xml file by reading the data into a C# class object that was generated by XSD.EXE. The class was generated from the myschema.xsd file that is contained in the InfoPath solution with a command line like:
0
2736
by: =?Utf-8?B?Q2hhcmxlcyBTaW1wc29u?= | last post by:
Hello I've tried in the InfoPath groups but no luck yet. Here is my situation: All computers are on an Active Directory domain in the company. I have an Infopath form stored on the network (in SharePoint) that needs to be able to update a SharePoint list when a button is clicked. I got the sample code from a book called "Developing Solutions with Microsoft InfoPath".
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10034
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.