
Signature
Kalyan G Reddy - INFOPATH MVP 2007
http://www.ggktech.com
> Hello
>
> Please read the link below
> http://www.infopathdev.com/forums/thread/17465.aspx
>
> I hope it helps you
Hi Kalyan, thanks for your help.
That article is very usefull for me while using Web Services, but i would
like to know if it's posible to change te Data Connection in an infopath 2007
form, by code, without using Web Services or anything else, just code.
thx a lot!
> > Hi all!
> >
[quoted text clipped - 11 lines]
> >
> > thanks in advance!!!
Kalyan G Reddy MVP (GGK Tech) - 07 Aug 2007 11:38 GMT
Hello
Webservice is one kind of a dataconnection. Which Dataconnection are you
trying to change dynamically?

Signature
Kalyan G Reddy - INFOPATH MVP 2007
http://www.ggktech.com
> > Hello
> >
[quoted text clipped - 26 lines]
> > >
> > > thanks in advance!!!
Veelicus - 07 Aug 2007 12:12 GMT
Hi again.
I am using a Data Origin, it's a connection from an Sql server 2005.
I write this code:
foreach (DataConnection conexion in DataConnections)
{
conexion.Name.ToString();
}
and conexion is the DataConnection, made while desiging the template.
While debugging, i look into conexion.
and this is what i see
- conexion {Microsoft.Office.InfoPath.Internal.AdoQueryConnectionHost} Microsoft.Office.InfoPath.DataConnection
{Microsoft.Office.InfoPath.Internal.AdoQueryConnectionHost}
- [Microsoft.Office.InfoPath.Internal.AdoQueryConnectionHost] {Microsoft.Office.InfoPath.Internal.AdoQueryConnectionHost} Microsoft.Office.InfoPath.Internal.AdoQueryConnectionHost
+ base {Microsoft.Office.InfoPath.Internal.AdoQueryConnectionHost} Microsoft.Office.InfoPath.AdoQueryConnection
{Microsoft.Office.InfoPath.Internal.AdoQueryConnectionHost}
Command "select \"Nombre\",\"Apellido1\",\"Apellido2\",\"Delegacion\" from
\"dbo\".\"PruebasMoss\" as \"PruebasMoss\"" string
Connection "Provider=SQLOLEDB.1;Password=User;Persist Security
Info=True;User ID=User;Initial Catalog=TestDB;Data Source=192.168.2.7;Use
Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation
ID=C3-0002;Use Encryption for Data=False;Tag with column collation when
possible=False" string
Name "PruebasMoss" string
Timeout 30 int
+ Miembros no públicos
Name "PruebasMoss" string
The code i want to change is the Command and the Connection string
Dynamically.
Any idea on how to do it?
> Hello
>
[quoted text clipped - 31 lines]
> > > >
> > > > thanks in advance!!!
Andy Bonner - 07 Aug 2007 22:05 GMT
Try this
foreach (AdoQueryConnection conexion in DataConnections)
{
conexion.Command = "whatever you want it to be";
conexion.Connection = "whatever you need this to be";
}
HTH
Andy
> Hi again.
>
[quoted text clipped - 77 lines]
>> > > >
>> > > > thanks in advance!!!
Veelicus - 08 Aug 2007 08:03 GMT
Thx Andy, that was what i need and also gave me an idea on how to solve
another problems!!!
Thx for Kalyan too for trying to help :)
> Try this
>
[quoted text clipped - 88 lines]
> >> > > >
> >> > > > thanks in advance!!!