SunQuest
 
           Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsOtherProgramming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old February 8th, 2004, 12:56 AM
alligator alligator is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 1 alligator User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Storing null and binary value in SQL Dbase using ASP

I am unable to store null values and numbers into my sql database variable that is storing null is trying to store null into field and in case of number i am soring number into numeric field.What is the problem plz help. This is the code of my asp page
<%
Dim objConn
Dim objRs
Dim vbRecCount
Dim strsql,yr,mnth
Dim vbTitle,vbAddVal,vbOffAdd,vbOffPh,vbHoAdd,vbHoPh,v bComm
Dim vbBillAdd,vbPhNo

set objConn =Server.CreateObject("ADODB.Connection")
objConn.ConnectionString="DSN=myfile"

'Opening Connection
objConn.open "","ashvini","ash"

if(len(month(date))<2) then
mnth="0" & month(date)
end if
yr=year(date)& mnth & datepart("d",date)
strsql = "select * from mysales WHERE trans_id like '" & yr & "%'"

set objRs = Server.CreateObject("ADODB.Recordset")
objRs.Open strsql,objConn,adOpenStatic,adLockOptimistic

'Counting Records for Matching Expression
if objRs.RecordCount=-1 then
vbRecCount=objRs.RecordCount + 2
else
vbRecCount=objRs.RecordCount + 1
end if

'Response.Write objRs.RecordCount
'Response.Write "<br>" & yr & vbRecCount

'Closing Table Connection After Counting
objRs.Close
set objRs=nothing

'Checking if Title is Empty
if Request("title")="" then
vbTitle="Null"
else
vbTitle=Request("title")
end if

'Checking which delivery option was selected(Home/Office)
if (Request("prdDel")=1) then
vbAddVal=0 'Storin Home Address and Phone Number
vbHoAdd=Request("hAdd")
vbBillAdd=Request("hAdd")
vbHoPh=Request("phnH")
vbPhNo=Request("phnH")
'Checking if Address(Office) is Empty
if Request("offAdd")="" then
vbOffAdd="Null"
else
vbOffAdd=Request("offAdd")
end if
'Checking if Ph. No.(Office) is Empty
if Request("phOff")="" then
vbOffPh="Null"
else
vbOffPh=Request("phOff")
end if
else
vbAddVal=1'Storing Office Address and Phone Number
vbOffAdd=Request("offAdd")
vbBillAdd=vbOffAdd
vbOffPh=Request("phOff")
vbPhNo=Request("phOff")
'Checking if Address(Home) is Empty
if Request("hAdd")="" then
vbHoAdd="Null"
else
vbHoAdd=Request("hAdd")
end if
'Checking if Ph. No.(Home) is Empty
if Request("phnH")="" then
vbHoPh="Null"
else
vbHoPh=Request("phnH")
end if
end if

'Checking if Comments is Empty
if Request("CmSgs")="" then
vbComm="Null"
else
vbComm=Request("CmSgs")
end if

'strsql="select * from mysales"
response.write vbAddVal
'Opening Recordset
set objRs = Server.CreateObject("ADODB.Recordset")
objRs.Open strsql,objConn,adOpenKeyset,adLockOptimistic

'Storing Records Into Database
objRs.AddNew
objRs("trans_id")=yr & vbRecCount
objRs("title")=Request("title")
objRs("fname")=Request("fname")
objRs("sname")=Request("sname")
objRs("addval")=vbAddVal "binary data"
objRs("hadd")=vbHoAdd
objRs("hph")=vbHoPh "numeric data"
objRs("oadd")=vbOffAdd
objRs("oph")=vbOffPh
objRs("prd_id")=Request("product")
objRs("price")="$" & Request("sprice")
objRs("prd_qty")=Request("qty")
objRs("tdate")=year(date) & "/" & mnth & "/" & datepart("d",date)
objRs("cm_sg")=vbComm
objRs.Update
%>

Reply With Quote
Reply

Viewing: ASP Free ForumsOtherProgramming Help > Storing null and binary value in SQL Dbase using ASP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway