hey guys hope you can help me with this error
with this button i whanne add values from an ASP webpage into my SQL database and i get an error on line 7 ( Embedded statement cannot be a declaration or labeled statement ) and the red line is only on the first Sql connection but not onder Conn - private void Opslaan()
-
{
-
string Klant = ddlKlant.SelectedItem.Text;
-
string Leverancier = ddlLeverancier.SelectedItem.Text;
-
txtRef.Text = GenReferentieNr(txtRef.Text);
-
if (imgBtnVerzamelSave.Visible == true)
-
SqlConnection Conn = new SqlConnection();
-
Conn.ConnectionString = @"Integrated Security = true; Initial Catalog=DB_visitid; Data Source=W2K3-01";
-
Conn.Open();
-
-
SqlCommand cmd = new SqlCommand();
-
cmd.Connection = Conn;
-
cmd.CommandText = "insert into offerte values ('"+Ref+"', '"+Leverancier+"', '"+TAV+"', '"+LevFax+"', '"+Klant+"', '"+Contact+"', '"+KlantFax+"', '"+Debetnr+"', '"+Omschrijving+"', '"+Aantal1+"', '"+Artikel1+"', '"+Bestelnr1+"', '"+OnzePrijs1+"', '"+PrijsKlant1+"', '"+LevTijd1+"', '"+Aantal2+"', '"+Artikel2+"', '"+Bestelnr2+"', '"+OnzePrijs2+"', '"+PrijsKlant2+"', '"+LevTijd2+"', '"+Aantal3+"', '"+Artikel3+"', '"+Bestelnr3+"', '"+OnzePrijs3+"', '"+PrijsKlant3+"', '"+LevTijd3+"', '"+Aantal4+"', '"+Artikel4+"', '"+Bestelnr4+"', '"+OnzePrijs4+"', '"+PrijsKlant4+"', '"+LevTijd4+"', '"+Aantal5+"', '"+Artikel5+"', '"+Bestelnr5+"', '"+OnzePrijs5+"', '"+PrijsKlant5+"', '"+LevTijd5+"', '"+Aantal6+"', '"+Artikel6+"', '"+Bestelnr6+"', '"+OnzePrijs6+"', '"+PrijsKlant6+"', '"+LevTijd6+"', '"+Aantal7+"', '"+Artikel7+"', '"+Bestelnr7+"', '"+OnzePrijs7+"', '"+PrijsKlant7+"', '"+LevTijd7+"', '"+Aantal8+"', '"+Artikel8+"', '"+Bestelnr8+"', '"+OnzePrijs8+"', '"+PrijsKlant8+"', '"+LevTijd8+"', '"+Aantal9+"', '"+Artikel9+"', '"+Bestelnr9+"', '"+OnzePrijs9+"', '"+PrijsKlant9+"', '"+LevTijd9+"', '"+Aantal10+"', '"+Artikel10+"', '"+Bestelnr10+"', '"+OnzePrijs10+"', '"+PrijsKlant10+"', '"+LevTijd10+"')";
-
Conn.Close();
-
}
I dont now if you need this code with it nut i maybe a easeyer to understand - private void imgBtnUpdate_Click(object sender, System.Web.UI.ImageClickEventArgs e)
-
{
-
Opslaan();
-
Server.Transfer("VerzamelStatus.aspx?ID=" + txtRef.Text);
-
}
2 1026
This is the C and C++ forum. These languages have nothing to do with C#. I'll move
your thread to the .NET forum where the C# questions are asked and answered.
kind regards,
Jos (moderator)
Well i ges i solved the error a bit logicly if i look at it now i still get another error but i first will look at it my self if i cant solve it youl here it here again Tnx for the help for the peaple whoe whanne see what i changed here is the code - private void Opslaan()
-
{
-
string Klant = ddlKlant.SelectedItem.Text;
-
string Leverancier = ddlLeverancier.SelectedItem.Text;
-
txtRef.Text = GenReferentieNr(txtRef.Text);
-
if (imgBtnVerzamelSave.Visible == true)
-
{
-
SqlConnection Conn = new SqlConnection();
-
Conn.ConnectionString = @"Integrated Security = true; Initial Catalog=DB_visitid; Data Source=W2K3-01";
-
Conn.Open();
-
SqlCommand cmd = new SqlCommand();
-
cmd.Connection = Conn;
-
cmd.CommandText = "insert into offerte values ('" + txtRef + "', '" + Leverancier + "', '" + txtTAV + "', '" + txtLevFax + "', '" + Klant + "', '" + txtContact + "', '" + txtKlantFax + "', '" + txtDebetNr + "', '" + txtOmschrijving + "', '" + txtAantal1 + "', '" + txtArtikel1 + "', '" + txtBestelNr1 + "', '" + txtOnzePrijs1 + "', '" + txtPrijsKlant1 + "', '" + txtLevTijd1 + "', '" + txtAantal2 + "', '" + txtArtikel2 + "', '" + txtBestelNr2 + "', '" + txtOnzePrijs2 + "', '" + txtPrijsKlant2 + "', '" + txtLevTijd2 + "', '" + txtAantal3 + "', '" + txtArtikel3 + "', '" + txtBestelNr3 + "', '" + txtOnzePrijs3 + "', '" + txtPrijsKlant3 + "', '" + txtLevTijd3 + "', '" + txtAantal4 + "', '" + txtArtikel4 + "', '" + txtBestelNr4 + "', '" + txtOnzePrijs4 + "', '" + txtPrijsKlant4 + "', '" + txtLevTijd4 + "', '" + txtAantal5 + "', '" + txtArtikel5 + "', '" + txtBestelNr5 + "', '" + txtOnzePrijs5 + "', '" + txtPrijsKlant5 + "', '" + txtLevTijd5 + "', '" + txtAantal6 + "', '" + txtArtikel6 + "', '" + txtBestelNr6 + "', '" + txtOnzePrijs6 + "', '" + txtPrijsKlant6 + "', '" + txtLevTijd6 + "', '" + txtAantal7 + "', '" + txtArtikel7 + "', '" + txtBestelNr7 + "', '" + txtOnzePrijs7 + "', '" + txtPrijsKlant7 + "', '" + txtLevTijd7 + "', '" + txtAantal8 + "', '" + txtArtikel8 + "', '" + txtBestelNr8 + "', '" + txtOnzePrijs8 + "', '" + txtPrijsKlant8 + "', '" + txtLevTijd8 + "', '" + txtAantal9 + "', '" + txtArtikel9 + "', '" + txtBestelNr9 + "', '" + txtOnzePrijs9 + "', '" + txtPrijsKlant9 + "', '" + txtLevTijd9 + "', '" + txtAantal10 + "', '" + txtArtikel10 + "', '" + txtBestelNr10 + "', '" + txtOnzePrijs10 + "', '" + txtPrijsKlant10 + "', '" + txtLevTijd10 + "')";
-
Conn.Close();
-
}
-
}
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Michael Brennan-White |
last post by:
If I submit my for using a get action the resulting page loads . If I
use a post action I get an error page saying "The page cannot be
found". I am calling the originating page!!! This happens...
|
by: Nathan |
last post by:
Hi,
I seem to having a peculiar problem with the display of odd and even
pages in XSL-FO. Here is a small background of the problem.
My xsl stylesheet mentions my fo:layout-master-set as
...
|
by: James |
last post by:
I've been to websites where if I navigate off a form, trying to get back to
it by hitting the back button gives me a page which says "Warning, page has
expired". It doesn't display the page. I've...
|
by: Kevin Phifer |
last post by:
Ok, before anyone freaks out, I have a solution I need to
create that gathers content from maybe different places.
Each one can return a <form> in the html, so its the
classic can't have more than...
|
by: John Lau |
last post by:
Hi,
Is there documentation that talks about the page lifecycle, the lifecycle of
controls on the page, and the rendering of inline code, in a single
document?
Thanks,
John
|
by: MooreSmnith |
last post by:
When I navigate to the next page using
Response.Rediect("MyNextPage.aspx") current page Page_Load event is called.
What I may wrongly understood is that post back will happen whenever there
is any...
|
by: Lenard Gunda |
last post by:
Hi!
I have the following problem.
From my main page, when someone clicks a button, it uses client side
javascript to open another .aspx page. This page displays content, based on
what the...
|
by: tshad |
last post by:
Is there a way to carry data that I have already read from the datagrid from
page to page?
I am looking at my Datagrid that I page through and when the user says get
the next page, I have to go...
|
by: UJ |
last post by:
I've got a page with a user control on it. While the page is loading, it
needs to check certain conditions of the user object to enable/disable
things on the screen. Currently in the page_load of...
|
by: Sakcee |
last post by:
Hi
this is really a stupid question, how can i get page rsponse from a
site e.g. google.com port 80
form socket, can i do something
import socket
s = socket.socket( socket.AF_INET,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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,...
|
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,...
|
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...
| |