473,326 Members | 2,081 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,326 software developers and data experts.

Insert to table failing

Hi,

I am new to ASP, so please bear with me if I am asking something basic.

In my asp code I am trying to insert values to a temp table with data entered on the page. When nothing was getting inserted to the temp table I tried and displayed the insert select statement. In the SQL I got, dateofref and rdatea and username as "". Please help me by explaining what could be the reasons for this.

sql_insert = "Insert into tbltemp ([dateofref], [rdatea], [rdateb]) values ('" & dateofref & "', '" & rdatea & "', '" & username & "')"

Thanks
Jan 8 '08 #1
2 1255
stepterr
157 100+
Hi,

I am new to ASP, so please bear with me if I am asking something basic.

In my asp code I am trying to insert values to a temp table with data entered on the page. When nothing was getting inserted to the temp table I tried and displayed the insert select statement. In the SQL I got, dateofref and rdatea and username as "". Please help me by explaining what could be the reasons for this.

sql_insert = "Insert into tbltemp ([dateofref], [rdatea], [rdateb]) values ('" & dateofref & "', '" & rdatea & "', '" & username & "')"

Thanks
Where in your code do you assign values to those fields? I would start looking there for the problem if they are showing up as being blank. For instance I have one page that contains my form. When the form is submitted it posts to a second page that actually does my sql statement. So one of the very first things I do on my second page is grab the values from the form. For example:

Inst = Request.Form("Inst")

Now that I have the value saved in Inst I can use that in my insert statement, just like you have it.
Jan 8 '08 #2
Nicodemas
164 Expert 100+
Hi,

I am new to ASP, so please bear with me if I am asking something basic.

In my asp code I am trying to insert values to a temp table with data entered on the page. When nothing was getting inserted to the temp table I tried and displayed the insert select statement. In the SQL I got, dateofref and rdatea and username as "". Please help me by explaining what could be the reasons for this.

sql_insert = "Insert into tbltemp ([dateofref], [rdatea], [rdateb]) values ('" & dateofref & "', '" & rdatea & "', '" & username & "')"

Thanks

Stepterr brings a good point. The named I bolded in your SQL statement are variables, and must be assigned a value before they'll stop being = "".
Jan 9 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: shottarum | last post by:
I currently have 2 tables as follows: CREATE TABLE . ( mhan8 int, mhac02 varchar(5), mhmot varchar(5), mhupmj int )
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
3
by: Almund Sebi | last post by:
Hello I use DB2 UDB V8.1.5. Using embedded SQL (SQLJava), I insert a row into a table which has some foreign keys and check constraints. The insert works fine, but if I encapsulate the insert...
6
by: Larry Johnson | last post by:
I have two similar SQL Server databases each with a table named Payments. PaymentID is an identity field and the primary, unique, key in both tables. There is one other key but it is not unique. ...
3
by: Hai Nguyen | last post by:
Hi all I was attempting to insert multiple row by using a loop into a database.A table has 2 primary keys and one regular field (PR) (PR) ID Project Ans 1 2 a 1 ...
11
by: sm | last post by:
Hi All, Can anybody give me the syntax to insert a record into SQL server through VB code using variables? The following statement is failing! sInsertQuery = "INSERT INTO TestTab (Col1, Col2,...
4
by: Chris Kratz | last post by:
Hello all, We have run into what appears to be a problem with rules and subselects in postgres 7.4.1. We have boiled it down to the following test case. If anyone has any thoughts as to why...
0
by: mwenz | last post by:
I am trying to update an Access table using OLEDB in VB.Net 2005. I can add rows but I cannot update them. Code to instantiate the Access database and table... Dim conn As New...
2
by: Deccypher | last post by:
sorry all i ever seam to do here is ask questions:( but im really stuck on the best way to do this what i have is 2 tables and im trying to make a 3rd table for compatibility example table...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.