473,805 Members | 2,164 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please help in systax on access Sql Server database via function

4 New Member
Hi, I am new on java function. I created a FORM in asp page, the FORM have three switch. When user selects UPDATE, first thing have to validate is check if this user id is in the control table or not. I think the best way is to check it inside a FUNCTION. I spend two days try to figure out the systax. Now I even doubt if access Sql Server database could be done inside the function or not? Could you please help me? Thank you.

What I think the systax like this?

function Preview2()
{
var strLast = document.frmAdd User.selLast.va lue;
var strFirst = document.frmAdd User.selFirst.v alue;

var objCon = Server.CreateOb ject("ADODB.Con nection");
var connstring = ("Driver={SQ L Server}; Server=mfintraw eb; Database=HR; UID=query; PWD=query");
objCon.open (connstring);
var SQLCommand = ("SELECT count(*) FROM dbo.Inve_User_E quAssigned where lastname = '" + strLast + "' and firstname = '" + strFirst + "'");
var objRS = objCon.Execute( SQLCommand);
var objReturn = objRS(0);

if ( objReturn == 0 )
{
alert ("The user " + strLast + ", " + strFirst + " is not in inventory control list. Check the user name, or add new user first.");
return false;
}
else
{
document.frmAdd User.action = 'manage_user_eq u.asp?mode=Edit &last=' + strlast + '&first=' + strfirst ;
document.frmAdd User.target = '_self';
return true;
}
}
Sep 28 '06 #1
4 2201
r035198x
13,262 MVP
Hi, I am new on java function. I created a FORM in asp page, the FORM have three switch. When user selects UPDATE, first thing have to validate is check if this user id is in the control table or not. I think the best way is to check it inside a FUNCTION. I spend two days try to figure out the systax. Now I even doubt if access Sql Server database could be done inside the function or not? Could you please help me? Thank you.

What I think the systax like this?

function Preview2()
{
var strLast = document.frmAdd User.selLast.va lue;
var strFirst = document.frmAdd User.selFirst.v alue;

var objCon = Server.CreateOb ject("ADODB.Con nection");
var connstring = ("Driver={SQ L Server}; Server=mfintraw eb; Database=HR; UID=query; PWD=query");
objCon.open (connstring);
var SQLCommand = ("SELECT count(*) FROM dbo.Inve_User_E quAssigned where lastname = '" + strLast + "' and firstname = '" + strFirst + "'");
var objRS = objCon.Execute( SQLCommand);
var objReturn = objRS(0);

if ( objReturn == 0 )
{
alert ("The user " + strLast + ", " + strFirst + " is not in inventory control list. Check the user name, or add new user first.");
return false;
}
else
{
document.frmAdd User.action = 'manage_user_eq u.asp?mode=Edit &last=' + strlast + '&first=' + strfirst ;
document.frmAdd User.target = '_self';
return true;
}
}
surely you are not trying to connect to a database using javascript?
Sep 28 '06 #2
lligogogo
4 New Member
surely you are not trying to connect to a database using javascript?
Hi r035198x,

Thank you for reply.

I am not sure what you mean? Does you said, I could not access to database via java function?

I did want to access to Sql Server inside function. Does java function not support it?
Sep 28 '06 #3
r035198x
13,262 MVP
Hi r035198x,

Thank you for reply.

I am not sure what you mean? Does you said, I could not access to database via java function?

I did want to access to Sql Server inside function. Does java function not support it?
What you are writting is javascript not java.
It is possible to connect to a database in java using jdbc.
javascript is client side and cannot access a database directly.
Sep 28 '06 #4
lligogogo
4 New Member
What you are writting is javascript not java.
It is possible to connect to a database in java using jdbc.
javascript is client side and cannot access a database directly.
Hi r035198x,

Thank you for your information. I will looking into the jdbc.
Sep 28 '06 #5

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

Similar topics

3
3356
by: cooldv | last post by:
i am running a website on Windows 2000 server with ASP 3 webpages and Access 2000 database. (with a hosting company) traffic is slow at this time but expect to grow. lately i have been reading about sql database and sql server, specially this article: http://www.aspfaq.com/show.asp?id=2195 will someone help me understand: 1. with *SQL Server*, do i keep my current Access 2000 database and ASP pages?
4
1929
by: Kenny Ashton | last post by:
Hello gurus Can I ask you opions on the best compromise for storing Access Ado connection strings in a IIS4 standard ASP environment. For any method I use, there seems to be an article somewhere that says 'never' do this, or that. 1. I have 3 site folders s1, s2, s2 and a common DB folder outside the site roots. /sites/s1 /sites/s2
2
17764
by: Amanda | last post by:
From a guy in Microsoft newsgroups: | In *comp.databases.ibm-db2* there are always IBM guys | from the Toronto labs on line.Post with the | -for the love of god please help- | line and I'm sure you'll get their attention. | Their usually very good:) So here's my transplanted post ==========================================
2
5568
by: Mike | last post by:
Greetings, Having a major problem here. running version 8.2 on win2003 server. The problem I am having is backing up a database seems to get to the last part of the backup and then fails. This brings the whole instance down and it has to be restarted. In addition the job seems to be stuck in the TOOLSDB as if I try to delete the backup job I get "The task is currently running". So I went to the command line and tried "db2 backup database...
1
9207
by: Andrew Arace | last post by:
I scoured the groups for some hands on code to perform the menial task of exporting table data from an Access 2000 database to Oracle database (in this case, it was oracle 8i but i'm assuming this will work for 9i and even 10g ) No one had what I needed, so I wrote it myself. I Rule. This code isn't going for efficiency, and isn't trying to be dynamic. It doesn't create the table structure in Oracle, that's up to you. (I
4
2433
by: Tarun Mistry | last post by:
Hi all, I have posted this in both the c# and asp.net groups as it applies to both (apologies if it breaks some group rules). I am making a web app in asp.net using c#. This is the first fully OO application I will be making, also my first .NET application, so im looking for any help and guidance. Ok, my problems are todo with object and database abstraction, what should i do.
1
3764
by: Brad Isaacs | last post by:
I am working with ASP.NET 2.0 and using an SQL Server 2000 database. I am using Visual Studio 2005 and developing on my Local machine. I am working with Login controls ASP.Configuration, I wanted to move my work and needed to place it on the server. Using VS 2005 , went to BUILD -Publish Web Site Checked the box for :: Alow this precompiled site to be updatable.
4
2219
by: Brad Isaacs | last post by:
I am working with ASP.NET 2.0 and using an SQL Server 2000 database. I am using Visual Studio 2005 and developing on my Local machine. I am working with Login controls ASP.Configuration, I wanted to move my work and needed to place it on the server. Using VS 2005 , went to BUILD -Publish Web Site Checked the box for :: Alow this precompiled site to be updatable.
2
2920
by: hotflash | last post by:
Hi Master CroCrew, I found a good PURE ASP that will allow you to upload 10MB file to the server and the file contents such as Network, Author, Title, etc... will insert to MS Access at the same time. Below is a working script that I used. Let's say after the file is uploaded to the server and a record created with the file contents above to the MS Access (using the script below). If I want to UPDATE that record let's say, change the...
0
9718
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10613
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10368
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10107
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5544
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3846
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.