Submit to Database option is no longer available

  • Thread starter Galactic Princess
  • Start date
G

Galactic Princess

I used to be able to select Submit to Database as one of my submit options.
This is no longer the case. I have heard through the grapevine that this is
due to the SP2 installed in October 2005. I have no idea if this is true, but
I need a workaround or a fix for this, as I have wasted so much time trying
to figure out why this isn't working. Does anyone have a fix or some code
that would solve this problem? All I want to do is submit my form content to
a database on buttonclick. HELP!

Thanks
Janice
 
U

Uma

Hi,

If you want to solve your problem through the code just follow these steps
to submit the data to the data base.

The steps are:
1. Take one button in the form.
2. Go to button properties and select “submit†for the “Action†drop down &
give one label for your button.
3. Go to tools->submitting forms->select the radio button option for “Enable
submit commands and buttons†->and select the option “custom submit using
form code†for the “submit to:†drop down box.
4. Check the “Edit form code†check box, and click ok.
5. It will goes to onSubmitRequest() function in the script editor there u
have to write the code to submit the data to the database for a button click.
 
G

Galactic Princess

Hi Uma:

What code do I need to put in there? I have no programming experience, so I
need exact syntax. Thanks.
 
S

Sandeep

Hi Galactic Princess.

This is C# code
Submit to SQL database
..........
string connStr ="server=system6;" + "integrated security=SSPI;" + "database=
employe";

SqlConnection conn = new SqlConnection(connStr);
string insert= "insert into employee2 values (@id,@name)";
SqlCommand cmd=new SqlCommand (insert,conn);
cmd.Parameters.Add(new SqlParameter("@id", SqlDbType.Char)).Value =
thisXDocument.DOM.selectSingleNode("/my:myFields/my:field1").text;
cmd.Parameters.Add(new SqlParameter("@name",SqlDbType.char)).Value =
thisXDocument.DOM.selectSingleNode("/my:myFields/my:field2").text;
conn.Open ();
cmd.ExecuteNonQuery ();
conn.Close ();

I hope this will help U
 
Top