LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.dotnet.framework.adonet,microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 13
Default insert doesn't work

Hi,

i developped an survey application in asp.net using excel as database (i
know that excel is not ideal for that, but this is the only option). The
person in our compagny who want to make a survey types his questions and
other specifications (type of question, mi/max values ..) in excel and sends
it to me.
I make then a table for gathering the answers.
When someone has answered all the question in the form, he pushes the button
"save" which causes a postback to the page with this javascript code:

.........
inscomm = "insert into data (login," + vragen + waarden
document.getElementById("sql").value=inscomm
document.getElementById("conn").value=conn
document.getElementById("ins").action="survey.aspx "
document.getElementById("ins").submit()
return true;

This is the content of "sql" :
-------------------------
insert into data
(login,vraag1,vraag2,vraag3,vraag4,vraag5,vraag6,v raag7,vraag8,vraag9,vraag10,vraag11,vraag12,vraago 13,vraago14,vraag15,vraag16,vraag17,vraag18,vraag1 9,vraag20,vraag21,vraag22,vraag23,vraag24,vraag25, vraag26,vraago27,vraago28,vraag29,vraag30,vraag31, vraag32,vraag33,vraag34,vraag35,vraag36,vraag37,vr aag38,vraag39,vraag40,vraago41,vraago42,vraag43,vr aag44,vraag45,vraag46,vraag47,vraag48,vraag49,vraa g50,vraag51,vraag52,vraag53,vraag54,vraago55,vraag o56,vraag57,vraag58,vraag59,vraag60,vraag61,vraag6 2,vraag63,vraag64,vraag65,vraag66,vraag67,vraag68, vraago69,vraago70,vraag71,vraag72,vraag73,vraag74, vraag75,vraag76,vraag77,vraag78,vraag79,vraag80,vr aag81,vraag82,vraago83,vraago84,vraag85,vraag86,vr aag87,vraag88,vraag89,vraag90,vraag91,vraag92,vraa g93,vraag94,vraag95,vraag96,vraago97,vraago98,vraa g99,vraag100,vraag101,vraag102,vraag103,vraag104,v raag105,vraag106,vraag107,vraag108,vraag109,vraag1 10,vraago111,vraago112,vraag113,vraag114,vraag115, vraag116,vraag117,vraag118,vraag119,vraag120,vraag 121,vraag122,vraag123,vraag124,vraago125,vraago126 ,vraag127,vraag128,vraag129,vraag130,vraag131,vraa g132,vraag133,vraag134,vraag135,vraag136,vraag137, vraag138,vraago139,vraago140,vraag141,vraag142,vra ag143,vraag144,vraag145,vraag146,vraag147,vraag148 ,vraag149,vraag150,vraag151,vraag152,vraago153,vra ago154,vraag155,vraag156,vraag157,vraag158,vraag15 9,vraag160,vraag161,vraag162,vraag163,vraag164,vra ag165,vraag166,vraago167,vraago168,vraag169,vraag1 70,vraag171,vraag172,vraag173,vraag174,vraag175,vr aag176,vraag177,vraag178,vraag179,vraag180,vraago1 81,vraago182,vraag183,vraag184,vraag185,vraag186,v raag187,vraag188,vraag189,vraag190,vraag191,vraag1 92,vraag193,vraag194,vraago195,vraago196)
values ('1','1','1','1','1','1','1','1','1','1','1','1',' ','
','1','1','1','1','1','1','1','2','1','1','1','1', ' ','
','1','1','1','1','1','1','1','1','1','1','1','1', ' ','
','1','1','1','1','1','1','1','1','1','1','1','1', ' ','
','1','1','1','1','1','1','1','1','1','1','1','1', ' ','
','1','1','1','1','1','1','1','1','1','1','1','1', ' ','
','1','1','1','1','1','1','1','1','1','1','1','1', ' ','
','1','1','1','1','1','1','1','1','1','1','1','1', ' ','
','1','1','1','1','1','1','1','1','1','1','1','1', ' ','
','1','1','1','1','1','1','1','1','1','1','1','1', ' ','
','1','1','1','1','1','1','1','1','1','1','1','1', ' ','
','1','1','1','1','1','1','1','1','1','1','1','1', ' ','
','1','1','1','1','1','1','1','1','1','1','1','1', ' ','
','1','1','1','1','1','1','1','1','1','1','1','1', ' ',' ')

and "conn"::
-----------
Provider = Microsoft.Jet.OLEDB.4.0; Data Source =
c:\inetpub\wwwroot\enquete\excel\ros2rp0607.xls; Extended Properties=Excel
8.0;

Code-behind: If the Request.Form is not empty, the connection is made:
--------------
Imports System.Data.OleDb
Imports System.IO
Partial Class enquete
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

Dim stconn, sqlcomm
sqlcomm = Request.Form("sql")
stconn = Request.Form("conn")
If sqlcomm < "" Then
Dim oConnection As OleDbConnection
Dim sConnection As String
oConnection = New OleDbConnection()
Dim comd As OleDbCommand
sConnection = stconn
oConnection.ConnectionString = sConnection
oConnection.Open()
comd = New OleDbCommand(sqlcomm, oConnection)
comd.ExecuteNonQuery()
oConnection.Close()

Account ASPNET has write rights on excel.
My problem: no error, no message, nothing, only, the table in excel remains
empty.With other words, the insert doesn't occur.
Could someone give me some hints where to look for?
Other surveys with the same code but other excel sheet (other questions)
work. So the code cannot be wrong ...?

Thanks for help
Ben



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
My insert sheet tab won't work PawlingJohn Excel Worksheet Functions 0 January 20th 09 04:38 PM
Cannot work with Excel: doesn't allow to insert a new number Basil Gass Excel Discussion (Misc queries) 3 July 15th 07 08:00 PM
Insert formula into a cell doesn't work :S s80NL[_12_] Excel Programming 2 August 17th 06 05:03 PM
Why does Range.Rows.Insert sometimes not work? GaryAIS Excel Programming 0 May 23rd 06 11:41 PM
How do I work with the "dialogs" I can insert as worksheet tabs? Jerryclick Excel Worksheet Functions 1 August 8th 05 08:56 PM


All times are GMT +1. The time now is 12:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"