Storing All Stored Procedures In One Database To Minimize Different Connection Strings

Jul 20, 2005

In order to minimize the number of connection strings I have to use to
access different databases on the same Sql Server, I was considering
storing all stored procedures in just one database. I want to do this
because connection pooling in my application - ASP.NET is based on
this connection string. So if I need to access 6 different databases
on one sql server & set 6 different connection strings, I end up
creating 6 different connection pools.

Other than it might create more management work for the DBA, are there
any performance implications with implementing this scheme? Do stored
procedures run any slower if they access tables that are stored in
different databases within the same server?

Any comments/suggestions are appreciated.

TIA,
Minh Tran

View 4 Replies


ADVERTISEMENT

Storing Connection Strings

Oct 1, 2004

My app is in a shared hosting environment. They use SQL Server authentication and I'm not wild about storing user ids and passwords in web.config. What's the best practice for storing this connection string information?

Thanks

View 3 Replies View Related

Storing Connection Strings In Machine.config In SP2?

Mar 8, 2007

Is there now any way to store connection strings for use in SSIS packages in the machine.config with SP2?

View 4 Replies View Related

Problem With DateTime And Strings In Stored Procedures

Jul 23, 2005

I'm keeping in the database a log of all the sessions for myapplication. I'm trying to write a stored procedure that returns allthe sessions that; the login contains a certain string, loggedin aftera certain datetime and loggedout before another datetime. Anycombination of these parameters can be used and, if none, returns allthe log.Below is the code I came up with but I'm having a "Syntax errorconverting datetime from character string" exception. When not usingDateTime parameters everything works fine. Can you tell me how can Iavoid this exception? Thanks in advance...ALTER PROCEDURE dbo.RetrieveAllSessionHistoryItemsContaining(@Pattern Varchar(255),@From DateTime,@To DateTime)ASDECLARE @Query VARCHAR(500)SET @Query = 'SELECT * FROM SessionHistoryItems, Sessions WHERESessionHistoryItems.SessionId = Sessions.SessionId'DECLARE @conditions nvarchar(257)SET @conditions = '';IF LEN(@Pattern) > 0 BEGINSET @conditions = @conditions + ' Sessions.Login LIKE ''%' + @Pattern+ '%'''ENDIF @From IS NOT NULL BEGINIF LEN(@conditions) > 0 BEGINSET @conditions = @conditions + ' AND 'ENDSET @conditions = @conditions + ' SessionHistoryItems.LoggedOutAt >=' + @FromENDIF @To IS NOT NULL BEGINIF LEN(@conditions) > 0 BEGINSET @conditions = @conditions + ' AND 'ENDSET @conditions = @conditions + ' SessionHistoryItems.LoggedInAt <= '+ @ToENDIF LEN(@conditions) > 0 BEGINEXEC(@Query + ' AND ' + @conditions)ENDELSE BEGINEXEC(@Query)ENDRETURN

View 1 Replies View Related

Database Connection Strings

Aug 2, 2004

My question is, are the user id and password optional when creating a database connection string? I've created an asp page without including them, but in my aspx page (which is basically supposed to do the exact same thing as the asp page), I'm receiving the following error:

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

Source Error:


Line 48: DisplayConnection = New SqlConnection("Server=infomart;Database=psg")
Line 49: DisplayCommand = New SqlCommand("SELECT RollOutID,RequestedDate,Background,Product,StagingPushDate,ProdPushDate FROM rolloutrequests ORDER BY RollOutID DESC", DisplayConnection)
Line 50: DisplayConnection.Open()
Line 51: DataGrid2.DataSource = DisplayCommand.ExecuteReader()
Line 52: DataGrid2.DataBind()


Source File: c:inetpubwwwroot
olloutrequests
olloutrequests.aspx.vb Line: 50

Stack Trace:

[SqlException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +472
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
System.Data.SqlClient.SqlConnection.Open() +384
rolloutrequests.WebForm1.Page_Load(Object sender, EventArgs e) in c:inetpubwwwroot
olloutrequests
olloutrequests.aspx.vb:50
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731


Any help would be greatly appreciated! Thanks!

View 1 Replies View Related

Connection Strings For Create Database Queries

May 12, 2006

I'm using connection strings to SQL Server Express that have the form

"DataSource= .SQLEXPRESS;AttachDbFilename="(path to my development directory)CurrentDevelopmentDB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"

I'm assuming this works because the DB is already there, created "manually".

How might I build a connection string for a SQLCommand for a "Create DataBase" query?

I'm confused about what the AttachDbFileName would be, or if there would be another variable in its place, since there's no file yet.

Any guidance on this would be appreciated.

Thanks!

View 4 Replies View Related

DataType Storing Strings Of Variable Length ?

Aug 22, 2007

Hello guys!

I am looking for the best DataType that makes it possible to store strings of variable length (from 15 to 300 caracters, rarely longer).


Thanks a lot for any help !

Regards,
Fabianus

my favorit hoster is ASPnix : www.aspnix.com !

View 3 Replies View Related

Stored Procedure Text Is Not Storing In Database

May 14, 2008

hi
in my front end i have one text area where user can input his sql statements. for samller data its working. the data type of coulmn is Text in sql server 2005. but problem is when i try to store this data its showing error.i meant not storing data at all. if i cut some of line from this then in this case it stores the data .what should i do to overcome this problem

thanx a lot.

DECLARE @sTemp VARCHAR(10)
DECLARE @nMemberID INT
DECLARE @nPartnerID INT
DECLARE @nDocumentTypeNo INT
DECLARE @nDocumentFormat INT
DECLARE @sEmailAddress VARCHAR(200)
SET @sTemp = '{*MEMBERID*}'
IF UPPER(@sTemp) = 'NULL'
SET @nMemberID = NULL
ELSE
SET @nMemberID = CAST(@sTemp AS INT)
SET @sTemp = '{*PARTNERID*}'
IF UPPER(@sTemp) = 'NULL'
SET @nPartnerID = NULL
ELSE
SET @nPartnerID = CAST(@sTemp AS INT)
SET @sTemp = '{*DOCUMENTTYPENO*}'
IF UPPER(@sTemp) = 'NULL'
SET @nDocumentTypeNo = NULL
ELSE
SET @nDocumentTypeNo = CAST(@sTemp AS INT)
SET @sTemp = '{*DOCUMENTFORMAT*}'
IF UPPER(@sTemp) = 'NULL'
SET @nDocumentFormat = NULL
ELSE
SET @nDocumentFormat = CAST(@sTemp AS INT)
SET @sEmailAddress = '{*EMAILADDRESS*}'
IF EXISTS(SELECT *
FROM ProtocolSettings
WHERE ((@nMemberID IS NULL AND MemberID IS NULL) OR MemberID = @nMemberID)
AND ((@nPartnerID IS NULL AND PartnerID IS NULL) OR PartnerID = @nPartnerID)
AND ((@nDocumentTypeNo IS NULL AND DocumentTypeNo IS NULL) OR DocumentTypeNo = @nDocumentTypeNo)
AND ((@nDocumentFormat IS NULL AND DocumentFormatNo IS NULL) OR DocumentFormatNo = @nDocumentFormat)
AND ProtocolSettingNo = 307)
BEGIN
UPDATE ProtocolSettings
SET SettingValue = @sEmailAddress
WHERE ((@nMemberID IS NULL AND MemberID IS NULL) OR MemberID = @nMemberID)
AND ((@nPartnerID IS NULL AND PartnerID IS NULL) OR PartnerID = @nPartnerID)
AND ((@nDocumentTypeNo IS NULL AND DocumentTypeNo IS NULL) OR DocumentTypeNo = @nDocumentTypeNo)
AND ((@nDocumentFormat IS NULL AND DocumentFormatNo IS NULL) OR DocumentFormatNo = @nDocumentFormat)
AND ProtocolSettingNo = 307
END
ELSE
BEGIN
INSERT INTO ProtocolSettings (ProtocolSettingNo, MemberID, PartnerID, DocumentTypeNo, DocumentFormatNo, SettingValue)
VALUES(307, @nMemberID, @nPartnerID, @nDocumentTypeNo, @nDocumentFormat, @sEmailAddress)
END

View 4 Replies View Related

Connection Strings, Trusted-connection VS Username-password, SQL Server 2005 Express

Mar 9, 2007

All --
Please help.
I have some questions about connection strings.
 
BACKGROUND...

Note that I am using the "SQL Native Client OLE DB Provider", SQL Sever 2005 Express, ASP.NET, C#.NET, and VS.NET 2005.
Note that I do not want to use the "Attach a database file" type of connection string.
Note that I am using the site http://www.ConnectionStrings.com as a reference.
Note that this "Standard security" connection string...<add name="LocalSqlServer" connectionString="Server=MYTESTOFFICESERVERS;Database=MyDatabase;Uid=MyDatabaseUser;Pwd=MyDatabasePassword;" />...does not work and causes the following run-time error...A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)
Note that this "Trusted connection" connection string...<add name="LocalSqlServer" connectionString="Server=MYTESTOFFICESERVERS;Database=MyDatabase;Trusted_Connection=yes;" />...works but is less-than ideal because it uses a Trusted Connection rather than a Username/Password combination.
 
QUESTIONS...
(A) What exactly does the error in Item 4 mean?
(B) Do 4 and 5 imply that one must use a Trusted_Connection for all SQL Server 2005 Express connection strings when the database does not reside in the web application's App_Data folder or use a "Attach a database file" type of connection string?
(C) Are there any alternatives?
(D) What do you suggest?
 
Please advise.
Thank you.
-- Mark Kamoski

View 1 Replies View Related

How To Search And List All Stored Procs In My Database. I Can Do This For Tables, But Need To Figure Out How To Do It For Stored Procedures

Apr 29, 2008

How do I search for and print all stored procedure names in a particular database? I can use the following query to search and print out all table names in a database. I just need to figure out how to modify the code below to search for stored procedure names. Can anyone help me out?
 SELECT TABLE_SCHEMA + '.' + TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE'

View 1 Replies View Related

Which Is Better? Storing Data In The Database OR Storing It In The File System

Dec 29, 2006

Hello there,I just want to ask if storing data in dbase is much better than storing it in the file system? Because for one, i am currenlty developing my thesis which uploads a blob.doc file to a web server (currently i'm using the localhost of ASP.NET) then retrieves it from the local hostAlso i want to know if im right at this, the localhost of ASP.NET is the same as the one of a natural web server on the net? Because i'm just thinking of uploading and downloading the files from a web server. Although our thesis defense didn't require us to really upload it on the net, we were advised to use a localhost on our PC's. I'll be just using my local server Is it ok to just use a web server for storing files than a database?    

View 6 Replies View Related

How To Save Stored Procedure To NON System Stored Procedures - Or My Database

May 13, 2008

Greetings:

I have MSSQL 2005. On earlier versions of MSSQL saving a stored procedure wasn't a confusing action. However, every time I try to save my completed stored procedure (parsed successfully ) I'm prompted to save it as a query on the hard drive.

How do I cause the 'Save' action to add the new stored procedure to my database's list of stored procedures?

Thanks!

View 5 Replies View Related

Calling Stored Procedures From ADO.NET-VB 2005 Express:1)Compile Errors &&amp; Warnings,2)Northwind Database In Database Explorer?

Feb 13, 2008

Hi all,

I try to learn "How to Access Stored Procedures with ADO.NET 2.0 - VB 2005 Express: (1) Handling the Input and Output Parameters and (2) Reporting their Values in VB Forms". I found a good article "Calling Stored Procedures from ADO.NET" by John Paul Cook in http://www.dbzine.com/sql/sql-artices/cook6. I downloaded the source code into my VB 2005 Express:



Imports System.Data

Imports System.Data.SqlClient

Imports System.Data.SqlTypes

Public Class Form_Cook

Inherits System.Windows.Form.Form

#Region " Windows Form Designer generated code "

Public Sub New()

MyBase.New()

'This call is required by the Windows Form Designer.

InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

components.Dispose()

End If

End If

MyBase.Dispose(disposing)

End Sub

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer

'It can be modified using the Windows Form Designer.

'Do not modify it using the code editor.

Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox

Friend WithEvents labelPAF As System.Windows.Forms.Label

Friend WithEvents labelNbrPrices As System.Windows.Forms.Label

Friend WithEvents UpdatePrices As System.Windows.Forms.Button

Friend WithEvents textBoxPAF As System.Windows.Forms.TextBox

Friend WithEvents TenMostExpensive As System.Windows.Forms.Button

Friend WithEvents grdNorthwind As System.Windows.Forms.DataGrid

Friend WithEvents groupBox2 As System.Windows.Forms.GroupBox

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

Me.GroupBox1 = New System.Windows.Forms.GroupBox()

Me.labelPAF = New System.Windows.Forms.Label()

Me.labelNbrPrices = New System.Windows.Forms.Label()

Me.textBoxPAF = New System.Windows.Forms.TextBox()

Me.UpdatePrices = New System.Windows.Forms.Button()

Me.groupBox2 = New System.Windows.Forms.GroupBox()

Me.TenMostExpensive = New System.Windows.Forms.Button()

Me.grdNorthwind = New System.Windows.Forms.DataGrid()

Me.GroupBox1.SuspendLayout()

Me.groupBox2.SuspendLayout()

CType(Me.grdNorthwind, System.ComponentModel.ISupportInitialize).BeginInit()

Me.SuspendLayout()

'

'GroupBox1

'

Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.labelPAF, Me.labelNbrPrices, Me.textBoxPAF, Me.UpdatePrices})

Me.GroupBox1.Location = New System.Drawing.Point(8, 8)

Me.GroupBox1.Name = "GroupBox1"

Me.GroupBox1.Size = New System.Drawing.Size(240, 112)

Me.GroupBox1.TabIndex = 9

Me.GroupBox1.TabStop = False

'

'labelPAF

'

Me.labelPAF.Location = New System.Drawing.Point(8, 16)

Me.labelPAF.Name = "labelPAF"

Me.labelPAF.Size = New System.Drawing.Size(112, 32)

Me.labelPAF.TabIndex = 2

Me.labelPAF.Text = "Enter Price Adjustment Factor"

'

'labelNbrPrices

'

Me.labelNbrPrices.Location = New System.Drawing.Point(8, 80)

Me.labelNbrPrices.Name = "labelNbrPrices"

Me.labelNbrPrices.Size = New System.Drawing.Size(216, 16)

Me.labelNbrPrices.TabIndex = 5

'

'textBoxPAF

'

Me.textBoxPAF.Location = New System.Drawing.Point(120, 16)

Me.textBoxPAF.Name = "textBoxPAF"

Me.textBoxPAF.TabIndex = 0

Me.textBoxPAF.Text = ""

'

'UpdatePrices

'

Me.UpdatePrices.Location = New System.Drawing.Point(8, 48)

Me.UpdatePrices.Name = "UpdatePrices"

Me.UpdatePrices.Size = New System.Drawing.Size(88, 23)

Me.UpdatePrices.TabIndex = 6

Me.UpdatePrices.Text = "Update Prices"

'

'groupBox2

'

Me.groupBox2.Controls.AddRange(New System.Windows.Forms.Control() {Me.TenMostExpensive, Me.grdNorthwind})

<Part 1----To be continued due to the length of this post>

View 1 Replies View Related

User-defined Stored Procedures InsertCustomerin Northwind Database That Is Cached In Database Explorer:No New Values Inserted?

Jan 14, 2008

Hi all,

I put "Northwind" Database in the Database Explorer of my VB 2005 Express and I have created the following stored procedure in the Database Exploror:

--User-defined stored procedure 'InsertCustomer'--

ALTER PROCEDURE dbo.InsertCustomer

(

@CustomerID nchar(5),

@CompanyName nvarchar(40),

@ContactName nvarchar(30),

@ContactTitle nvarchar(30),

@Address nvarchar(60),

@City nvarchar(15),

@Region nvarchar(15),

@PostalCode nvarchar(10),

@Country nvarchar(15),

@Phone nvarchar(24),

@Fax nvarchar(24)

)

AS

INSERT INTO Customers

(

CustomerID,

CompanyName,

ContactName,

ContactTitle,

Address,

City,

Region,

PostalCode,

Country,

Phone,

Fax

)

VALUES

(

@CustomerID,

@CompanyName,

@ContactName,

@ContactTitle,

@Address,

@City,

@Region,

@PostalCode,

@Country,

@Phone,

@Fax

)
=================================================
In my VB 2005 Express, I created a project "KimmelCallNWspWithAdoNet" that had the following code:
--Form_Kimmel.vb--
Imports System.Data

Imports System.Data.SqlClient

Imports System.Data.SqlTypes

Public Class Form_Kimmel


Public Sub InsertCustomer()

Dim connectionString As String = "Integrated Security-SSPI;Persist Security Info=False;" + _

"Initial Catalog=northwind;Data Source=NAB-WK-EN12345"

Dim connection As SqlConnection = New SqlConnection(connectionString)

connection.Open()

Try

Dim command As SqlCommand = New SqlCommand("InsertCustomer", connection)

command.CommandType = CommandType.StoredProcedure

command.Parameters.Add("@CustomerID", "PAULK")

command.Parameters.Add("@CompanyName", "Pauly's Bar")

command.Parameters.Add("@ContactName", "Paul Kimmel")

command.Parameters.Add("@ContactTitle", "The Fat Man")

command.Parameters.Add("@Address", "31025 La Jolla")

command.Parameters.Add("@City", "Inglewoog")

command.Parameters.Add("@Region", "CA")

command.Parameters.Add("@Counrty", "USA")

command.Parameters.Add("@PostalCode", "90425")

command.Parameters.Add("@Phone", "(415) 555-1234")

command.Parameters.Add("@Fax", "(415 555-1235")

Console.WriteLine("Row inserted: " + _

command.ExecuteNonQuery().ToString)

Catch ex As Exception

Console.WriteLine(ex.Message)

Throw

Finally

connection.Close()

End Try



End Sub

End Class
==============================================


I executed the Form_Kimmel.vb and I got no errors. But I did not get the new values insterted in the table "Custermers" of Northwind database. Please help and tell me what I did wrong and how to correct this problem.

Thanks in advance,
Scott Chang

View 10 Replies View Related

Database Stored Procedures Not Showing Up In Database View

Jan 31, 2008

 Hi I have an application that I have started to develop.  I have successfully set the connection to open the SQL Server database that I created.  When I first started on the program, I was able to create Table Adapters by dragging the tables or stored procedures onto the DataSet work surface and going through the configuration process.  At one point, however, I stopped being able to see any of my stored procedures in the database view although they are there because when I go to create a new table adapter, I am able to right click and add the new adapter and find the stored procedure in the wizard.Is there any way I can reset this so that my stored procedures are visible again.  I have tried refreshing to no avail - and I think this is creating problems in other parts of the application.Any help appreciate.Roger 

View 1 Replies View Related

Trigger: To Fill Another Database With Using Stored Procedures Of The Other Database

Apr 24, 2007

Hello everyone,I face currently a problem where I could need some input for searchingthe source of the ProblemSystem: SQL Server 9.0I fill from Database A with triggers Database B, everything worksfine.On Database B there is a Stored Procedures that checks the records andadd additional information accordingly, this Stored Procedures isnormally called by the application on "update and insert" in theaccording table.When I try to call this Stored Procedures from the Database A, thetrigger does not work anymore, even if I do a try catch over the wholetrigger, he never reach the Catch and the insert I try to do there toget the error message.On both Databases the user, that is taken to execute the trigger isexistent and DB-Owner of both Databases.If I go and execute the Stored Procedures manually after an insert orupdate to Database B everything works fine.I also already tried to check on Database B if there is an insert orupdate from Database A and if, to execute the Stored Procedures, withthe same result, nothing and all happens anymore, neither update onDatabase A and also not on Database B.And also I cant catch the error as the Try/Catch is not working.Hope I could explain it understandable and maybe someone remembersalready having the same problem.Thanks & Best regardsPascal

View 2 Replies View Related

Exporting Stored Procedures In Sql 2005 From Database To Database?

Apr 14, 2008

I've never dealt with stored procedures much.. but i have a new database
created.. imported the tables, but the stored procedures didnt get copied
over..

Is there an easy way to export them.. perhaps to a .sql file ... then import
them or run a script on the other database..

I have never done much with the query window before, so i'm not sure how to
handle this.. as there are around 20 stored procedures that need imported..

Thanks for any tips...

View 5 Replies View Related

Is There A Way To Copy Whole Stored Procedures To Another Database?

Mar 1, 2008

is there a way to copy whole stored procedures to another database?
 I have aproximately 80 SPs in a database, I want to copy whole SPs into another DB. Is there a practical way to copy them?
Thanks

View 2 Replies View Related

I Must Transfer My Stored Procedures To Another Database. How?

Jun 16, 2008

Hi,
Is there a practical way to transfer Stored Procedures to another database?
Thanks.
 

View 1 Replies View Related

Assessment Of Database Stored Procedures

Apr 24, 2007

I am attempting to compile a list of questions that will enable meassess 'at risk' stored procedures that need to be remediated in orderto minimize unplanned downtime and enhance database performance. Isthere a subset of criteria (parameters) from the MS SQL Server BestPractices Analyzer that can be used for this purpose? Any pointers tothe appropriate documentation is most welcome.Thanks in advance.

View 1 Replies View Related

Copy Stored Procedures To Another Database

Jul 20, 2005

I have 2 databases, one that we use called MyShop and one that I develop oncalled TestShop.After I have a stored procedure working the way I want in TestShop , isthere a way to just copy the SP to the other database without the copy andpaste method?. Same if I have a new table. Any way to add it in withoutrecreating it in the MyShop database?I am using Sql Server 2000ThanksAndy

View 1 Replies View Related

Copying Stored Procedures From One Database To Another

Apr 19, 2007

How do i copy Stored Procedures from one SQL Express database to another?

View 8 Replies View Related

Allowing Access To Database Only Through Stored Procedures

Aug 31, 2006

I have read that it is possible to configure sql server express  so that the database can only be accessed through stored procedures. Can anyone tell me how to do this. Many thanks.martin

View 2 Replies View Related

Inserting Information Into An SQL Database Using Stored Procedures

Dec 16, 2005

Hello,
I'm building an ecommerce website which requires customers to create an account before they go ahead with a purchase. I have a createaccount.aspx page in Visual Web Developer 2005 with text boxes where users can enter their details (email, password, name and address).  I'm trying to insert the information which users type into the text boxes into an SQL database table called Customers.
I've dragged and dropped an SQL data source onto my page and have set it to operate on my AddCustomer stored procedure. I've confirgured my data source such that the parameter for each field in the database is set to the appropriate control on the webpage (for example the Email parameter source is "textboxEmail").
I've also placed a button onto my page so that the button click event can act as the trigger for sending the information in the text boxes to the database. I wasn't totally sure how to write code for the button click event such that when the button is clicked, the INSERT stored procedure runs. At the moment I'm using:
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
SqlDataSource1.Insert()
End Sub
When I try to run my application I'm getting an error which reads:
Cannot insert the value NULL into column 'Email', table 'C:DOCUMENTS AND SETTINGSLUKE JACKSONMY DOCUMENTSVISUAL STUDIO 2005WEBSITESJACKSONSNURSERIESAPP_DATADATABASE.MDF.dbo.Customers'; column does not allow nulls. INSERT fails.The statement has been terminated.
The error message implies that I haven't set the necessary parameters correctly but I really don't know where I'm going wrong!
The code I'm using for my stored procedure is as follows:
ALTER PROCEDURE AddCustomer
(
@CustomerID int,
@Email nvarchar(50),
@Password nvarchar(MAX),
@Name nvarchar(50),
@Address1 nvarchar(50),
@Address2 nvarchar(50),
@Address3 nvarchar(50),
@City nvarchar(50),
@County nvarchar(50),
@PostCode nvarchar(50)
)
AS
INSERT INTO Customers
(Email, Password, Name, Address1, Address2, Address3, City, County, PostCode)
VALUES
(@Email, @Password, @Name, @Address1, @Address2, @Address3, @City, @County, @PostCode)
I'd be really grateful if anyone could help me out with this.
Thanks in advance,
Luke
p.s. just incase it helps, here's my createaccount.aspx page:
<%@ Page Language="VB" MasterPageFile="~/Master.master" AutoEventWireup="false" CodeFile="createaccount.aspx.vb" Inherits="createaccount" title="Untitled Page" %>
<%-- Add content controls here --%>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
<span style="text-decoration: underline"><strong>Create Account<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="AddCustomer" SelectCommandType="StoredProcedure" InsertCommand="INSERT INTO Customers&#13;&#10;&#9;(Email, Password, Name, Address1, Address2, Address3, City, County, PostCode)&#13;&#10;&#9;VALUES&#13;&#10;&#9;(@Email, @Password, @Name, @Address1, @Address2, @Address3, @City, @County, @PostCode)">
<SelectParameters>
<asp:Parameter Name="CustomerID" Type="Int32" />
<asp:ControlParameter ControlID="textboxEmail" Name="Email" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="textboxPassword" Name="Password" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="textboxName" Name="Name" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="textboxAddress" Name="Address1" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="textboxAddress2" Name="Address2" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="textboxAddress3" Name="Address3" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="textboxCity" Name="City" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="textboxCounty" Name="County" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="textboxPostCode" Name="PostCode" PropertyName="Text"
Type="String" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="Email" Type="String" />
<asp:Parameter Name="Password" Type="String" />
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Address1" Type="String" />
<asp:Parameter Name="Address2" Type="String" />
<asp:Parameter Name="Address3" Type="String" />
<asp:Parameter Name="City" Type="String" />
<asp:Parameter Name="County" Type="String" />
<asp:Parameter Name="PostCode" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<br />
</strong></span>
<table style="font-weight: bold; width: 394px; text-decoration: underline">
<tr>
<td style="width: 111px; height: 21px; text-align: left">
Email:</td>
<td style="height: 21px">
<asp:TextBox ID="textboxEmail" runat="server" Width="147px"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 111px; height: 21px; text-align: left">
Password:</td>
<td style="height: 21px">
<asp:TextBox ID="textboxPassword" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 111px; height: 21px; text-align: left">
Name:</td>
<td style="height: 21px">
<asp:TextBox ID="textboxName" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 111px; text-align: left">
Address 1:</td>
<td>
<asp:TextBox ID="textboxAddress" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 111px; height: 21px; text-align: left">
Address 2:</td>
<td style="height: 21px">
<asp:TextBox ID="textboxAddress2" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 111px; text-align: left">
Address 3:</td>
<td>
<asp:TextBox ID="textboxAddress3" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 111px; text-align: left">
City:</td>
<td>
<asp:TextBox ID="textboxCity" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 111px; height: 21px; text-align: left">
County:</td>
<td style="height: 21px">
<asp:TextBox ID="textboxCounty" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 111px; text-align: left">
Post Code:</td>
<td>
<asp:TextBox ID="textboxPostCode" runat="server"></asp:TextBox></td>
</tr>
</table>
<asp:Button ID="btnSubmit" runat="server" Text="Submit" />
</asp:Content>
Thanks again

View 1 Replies View Related

SQL Server 2008 :: Run All Stored Procedures In A Database

Feb 12, 2015

I'm looking for an easy way to run all stored procedures in a database that match a specified criteria.

Under normal curcumstances, I'd create a "master" procedure that would call each one in turn using the "EXECUTE" syntax.

As there will be around 140 procedures (there are a few more but they are used for different purposes), I'd like to try and execute them dynamically.

Is there any way of finding out which procedures match the pattern of "usp_merge_*" for the name and executing it?

View 4 Replies View Related

Want To Run Stored Procedures To Build Maintenance Database

May 13, 2015

create all the maintenance scripts (SProcs) to my maintenance databases in an automated way?I have around 12 procedures which I don't want to consolidate in a single Proc and execute.Another problem which is coming to my mind is, I can';t use the below method to execute the proc, as I dont have RDP access to the servers.

sqlcmd -i C:MyFolderMyScript.sql -o C:MyFolderMyOutput.txt

I am thinking to ask for a central location where I can create a folder , dumping all my scripts and build the maintenance DB and creating all my procs, table, etc.

View 1 Replies View Related

Inter-database Stored Procedures And Permissions

Jul 20, 2005

Hello all, this is my second post to this newsgroup. It's a questionabout stored procedures and permissions and how these behave betweendatabases.Here's the scenario. I have a database that stores information for asystem "A", and I have a different database on the same SQL serverthat stores the login and other info "LOGIN". I write a storedprocedure in the "A" database that checks some tables in the "LOGIN"database, let's call this "SP_A".Additionally I have a user account that accesses all appropriatestored procedures in "A" called "USER_A", and the same for the "LOGIN"database, "USER_LOGIN".Here's the part that raised my curiosity. I log into the server viaQuery Analyzer using the "USER_A" account. I run "SP_A" which does ajoin between some table in "A" and another table in "LOGIN". I give"USER_A" execute permission on "SP_A", then I try to run "SP_A" andget an error:SELECT permission denied on object '(table in "LOGIN" database)',database '(real name of "LOGIN")', owner 'dbo'Huh? how come I need to assign additional select permissions in thisdatabase if I'm not doing an actual select statement? I'm not evendynamically running a select statement through an exec function. Thisjust struck me as odd, seeing as how I never explicitly set SELECTpermission on any table in "A" for "USER_A", yet my stored procedureworks, but between databases I have to assign extra permissions for astored procedure "SP_A" access to the tables in "LOGIN".Anyone able to explain this behavior? Because I'm at a loss and I'veonly been doing this DB thing for about 2 years.Thanks in advance, all.-TJ

View 4 Replies View Related

How Tocop Stored Procedures And Functions From One Database To Another?

Oct 9, 2006

Hello,

Is there a way to copy some selected or all stored procedures and functions from one database to another?

Thanks in advance.

Best regards,

View 3 Replies View Related

Oracle Stored Procedures VERSUS SQL Server Stored Procedures

Jul 23, 2005

I want to know the differences between SQL Server 2000 storedprocedures and oracle stored procedures? Do they have differentsyntax? The concept should be the same that the stored proceduresexecute in the database server with better performance?Please advise good references for Oracle stored procedures also.thanks!!

View 11 Replies View Related

Using Stored Procedures To Insert And Pull Data From Database

Mar 21, 2008

I have my database: "RequestTrack"
My table (with its columns): "Request"RequestKey (automatically generated)..and the Primary KeyEntryDate  (datetime)Summary (nvarchar)RequestStatusCodeKey (bigint)EntryUserID   (nvarchar)EntryUserEmail (nvarchar)I am wanting to create a basic web form where my user interface has 3 text boxes and a Submit button:
txtUserID.TexttxtEmailAddress.TexttxtRequestSummary.Text
**After I hit the submit button the information will then be inserted into the database. Also the RequestStatusCodeKey will be MANUALLY typed in so that will not require the user to add that. Please please please help ! I've been searching online for days and looking at various websites and still havent found anything. I've found somethings but they went into too much depth with too much information. I am just wanting to stay basic but w/o using SQLDataSource Controls. I would like to be able to store a lot of data. Thanks for your help!!!

View 4 Replies View Related

SQL Server 2008 :: Clone Stored Procedures From Database A To B

Apr 24, 2015

I have this requirement where some store procedures from a "seed" database need to be replicated to another database (on demand, so replication is not suppose to be use in this scenario).

I know it can be achieved by exporting the store procedures and then execute that at the B database but I want something a bit more automatic since it can be a large number of sprocs. I am trying something like this (still in dev):

SET NOCOUNT ON;
--
SELECT ROW_NUMBER() OVER(ORDER BY definition) seq, definition base
into #sprocs
FROM databaseA.[sys].[procedures] p
INNER JOIN databaseA.sys.sql_modules m ON p.object_id = m.object_id

[Code] ....

But I am sure there are way better ways to accomplish that...

View 4 Replies View Related

SQL2005 Stored Procedures Don't Execute After Attach Database

Sep 19, 2006

While doing maintenance on a development server we detached a database and later reattached it to the same server.

For some unknown reason web services execute but return no results. There are no errors reported in event viewer. I connected to the database in Visual Studio 2005 and attempted to execute a simple select statement but it returns no row.

It appears to execute the stored procedure but does not return any data. I have cut and pasted the select statement into a View which does execute.

Lastly I just created a new store procedure to test the database and it also does not return any rows. This is all very strange.

Could use a few suggestions at this point.

Larry

View 2 Replies View Related

Connection Strings

Nov 11, 2006

I am trying to develop a web site. I have a local ms sql database on my machine.
I am trying to connect to a ms Sql database on a goDaddy server from the application.
I am trying to understand the connection string and its total properties.
here is what I think should be in my web.config file

add name="Personal" connectionString="Server=whsql-v12.prod.mesa1.secureserver.net;
Database=DB_XX10;
User ID=myID;
Password=myypassword;
Trusted_Connection=False" providerName="System.Data.SqlClient"
 
/>
<remove name="LocalSqlServer"/>
can someone please tell me where I am going wrong, Thanks for your help.....

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved