473,320 Members | 1,896 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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(ByVal 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(sqlAdamUpdate, adamConn)

cmdAdamUpdate.Parameters.Add(NewSystem.Data.SqlCli ent.SqlParameter("@ID",system.Data.SqlDbType.VarCh ar, 10, "ADMAID").Value = SOME THINGI CAN"T FIGURE OUT)
cmdAdamUpdate.Parameters.Add(NewSystem.Data.SqlCli ent.SqlParameter("@PG",System.Data.SqlDbType.VarCh ar, 10, "ADMAPG"))
cmdAdamUpdate.Parameters.Add(NewSystem.Data.SqlCli ent.SqlParameter("@LT",System.Data.SqlDbType.VarCh ar, 10, "ADMALT"))
cmdAdamUpdate.Parameters.Add(NewSystem.Data.SqlCli ent.SqlParameter("@TX",System.Data.SqlDbType.VarCh ar, 10, "ADMATX"))

adamConn.Open()
cmdAdamUpdate.ExecuteNonQuery()
adamConn.Close()

This produces the following error:
System.Web.Services.Protocols.SoapException: Server was unable toprocess request. ---> System.Data.SqlClient.SqlException:Prepared statement '(@ADMAID varchar(10),@ADMAPGvarchar(10),@ADMALT varchar(10),@AD' expects parameter @ADMAID,which was not supplied.

I've Tried this:
Public Function UpdateADMST(ByVal 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.Tables.Add(ADMST)

Dim ID_col As New DataColumn("ADMAID")
adam_UpDS.Tables(0).Columns.Add(ID_col)

Dim PG_col As New DataColumn("ADMAPG")
adam_UpDS.Tables(0).Columns.Add(PG_col)

Dim LT_col As New DataColumn("ADMALT")
adam_UpDS.Tables(0).Columns.Add(LT_col)

Dim TX_col As New DataColumn("ADMATX")
adam_UpDS.Tables(0).Columns.Add(TX_col)

Dim adam_row As DataRow
adam_row = adam_UpDS.Tables(0).NewRow()

adam_row.Item(0) = ID.Substring(0, ID_len)
adam_UpDS.Tables(0).Rows.Add(adam_row)

adam_row.Item(1) = PG.Substring(0, PG_len)
adam_UpDS.Tables(0).Rows.Add(adam_row)

adam_row.Item(2) = LT.Substring(0, LT_len)
adam_UpDS.Tables(0).Rows.Add(adam_row)

adam_row.Item(3) = TX.Substring(0, TX_len)
adam_UpDS.Tables(0).Rows.Add(adam_row)

SqlDataAdapter1.Update(adam_UpDS)

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 2716

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

Similar topics

0
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...
0
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...
4
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...
0
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...
5
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...
4
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...
0
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'";...
3
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.