Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
gooner
Starting Member
2 Posts |
Posted - 2002-09-20 : 19:26:32
|
Heeeeeeeeelp! Anyone got a white horse???I should start by saying that I'm a fairly newbie to MS SQL Server. I'm trying to develop an administration front-end (ASP) for a database that will drive a content management system. I'm creating forms for users to input data that will update the MS SQL database look-up tables via a very basic stored procedure (insert). Trouble is, although I can get the script to "work", for every entry that a user inputs, a further 10 or so blank fields are automatically created in the database table. There are only two colums in the table, and one of those is an identity field. The weird thing is that I have disallowed nulls for the other column that is playing up, but the system is allowing the entries.PLEASE...What am I doing wrong???? I've got another 20 of these look-up tables to do and I'd like to get the first one right! Is anybody out there???? |
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-09-20 : 19:44:31
|
My white horse isn't a mind reader ....Post your code.Jay White{0} |
 |
|
gooner
Starting Member
2 Posts |
Posted - 2002-09-20 : 20:04:55
|
Oops! Sorry. Here's the code for the MS SQL stored procedures and the basic ASP document that I created to test my poor effort at a masterpiece.SPROC FOR usp_insert_job_titles:CREATE PROCEDURE [usp_insert_job_titles] (@addjobtitle [varchar](80))AS INSERT INTO [gfg].[dbo].[Job_titles] ( [job_title]) VALUES ( @addjobtitle)GO SPROC FOR usp_show_job_titles:[code]CREATE PROCEDURE [usp_show_job_titles] AS SELECT [job_title] FROM [gfg].[dbo].[Job_titles] WHERE [job_title_expire] IS NULL AND [job_title] >0ORDER BY [job_title] ASCGO[code](Note that the 2nd part of the WHERE statement was created to hide the blank columns when displaying in the browser)ASP PAGE:[code]<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%><!--#include file="Connections/gfg.asp" --><%Dim cmdJobTitles__addjobtitlecmdJobTitles__addjobtitle = ""if(Request("addjobtitle") <> "") then cmdJobTitles__addjobtitle = Request("addjobtitle")%><%set cmdJobTitles = Server.CreateObject("ADODB.Command")cmdJobTitles.ActiveConnection = MM_gfg_STRINGcmdJobTitles.CommandText = "dbo.usp_insert_job_titles"cmdJobTitles.CommandType = 4cmdJobTitles.CommandTimeout = 0cmdJobTitles.Prepared = truecmdJobTitles.Parameters.Append cmdJobTitles.CreateParameter("@addjobtitle", 200, 1,80,cmdJobTitles__addjobtitle)set rsAddJobTitles = cmdJobTitles.ExecutersAddJobTitles_numRows = 0%><%set cmdListJobTitles = Server.CreateObject("ADODB.Command")cmdListJobTitles.ActiveConnection = MM_gfg_STRINGcmdListJobTitles.CommandText = "dbo.usp_show_job_titles"cmdListJobTitles.CommandType = 4cmdListJobTitles.CommandTimeout = 0cmdListJobTitles.Prepared = truecmdListJobTitles.Parameters.Append cmdListJobTitles.CreateParameter("RETURN_VALUE", 3, 4)set rsListJobTitles = cmdListJobTitles.ExecutersListJobTitles_numRows = 0%><html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link href="/gfg_style/admin.css" rel="stylesheet" type="text/css"></head><body>This table is for inputing new job titles<form action="" method="post" name="addtitleform" id="addtitleform"> <table width="681" border="0" cellspacing="0" cellpadding="0"> <tr> <td><div align="right">add job title</div></td> <td><input name="addjobtitle" type="text" id="addjobtitle"></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><input name="submitjobtitle" type="submit" id="submitjobtitle" value="Submit"></td> </tr> </table><p> </p></form>This table is for showing existing job titles<form action="<%= Cstr(Request.ServerVariables("SCRIPT_NAME")) %>" method="post" name="listjobtitlesform" id="listjobtitlesform"> <table width="681" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="236"><div align="right">job titles</div></td> <td width="445"><select name="jobtitleslistbox" id="select" size="8"> <option value="%">View job titles</option> <%While (NOT rsListJobTitles.EOF)%> <option value="<%=(rsListJobTitles.Fields.Item("job_title").Value)%>"><%=(rsListJobTitles.Fields.Item("job_title").Value)%></option> <% rsListJobTitles.MoveNext()WendIf (rsListJobTitles.CursorType > 0) Then rsListJobTitles.MoveFirstElse rsListJobTitles.RequeryEnd If%> </select></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><input name="refreshjobtitles" type="submit" id="refreshjobtitles" value="Refresh"></td> </tr> </table></form></body></html><%rsListJobTitles.Close()Set rsListJobTitles = Nothing%>[code]UK time is now 1 in the morning. I can't spend anymore time on this today. Here's hoping... Thanks. |
 |
|
|
|
|
|
|