How Can I Return A Database From The DataBase Explorer Of VB 2005 Express To The Object Explorer Of SQL Server Management Studio

Mar 3, 2008

Hi all,

I just realized recently that a database "XYZ" in the Object Explorer of my SQL Server Management Studio Express (SSMSE) is put in the Database Explorer of my VB 2005 Express for processing a Stored Procedure in executing the SELECT statements (not by using Input and/or Output Parameters) during the ADO.NET 2.0-VB 2005 Express programming, then the content of the database "XYZ" is not in the SSMSE. How can I return the database "XYZ" from the DataBase Explorer of VB 2005 Express back to the Object Explorer of SQL Server Management Studio Express (SSMSE) safely? Please help and advise.

Thanks in advance,
Scott Chang

View 6 Replies


ADVERTISEMENT

SQL Server Management Studio Express: Object Explorer - How To Re-attach The Content Of User-defined Database

Nov 21, 2007

Hi all,



I just found that the content of my Database "ssmsExpressDB" is gone, but the name "ssmsExpressDB" remains in the Object Explorer of SQL Server Management Studio Express. If I delected the name "ssmsExpressDB" and executed the following .sql:



exec sp_attach_db @dbname = N'ssmsExpressDB',

@filename1 = N'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDatassmsExpressDB.mdf',

@filename2 = N'C:Program filesMicrosoft SQL ServerMSSQL.1MSSQLDatassmsExpressDB_log.LDF'

GO



I got the following error message:



Msg 5120, Level 16, State 101, Line 1

Unable to open the physical file "C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDatassmsExpressDB.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".





And I have closed all my projects and I do not know what " The process cannot access the file because it is being used by another process" is all about!? Please help and tell me how I can re-attach the content of my "ssmsExpressDB" in the Object Explorer of SQL Server Management Studio Express.



Thanks in advance,

Scott Chang

====================================================================================

I found the "ssmsExpressDB" is being used by my VB 2005 Express project "Hello-SQLCLR-1": in the Database Explorer, Data Connections place. How can I put it back to the Object Explorer of SQL Server Management Studio Express? Please help and advise.

=======================================================

View 6 Replies View Related

SQL Server Management Studio Express, Database Explorer In Visual Web Developer Express...which To Use???

Apr 16, 2007

When I downloaded/started using Visual Web Developer I was under the impression that I needed to install SQL Server Management Studio Express in order to create/manage databases, and to provide the engine to access the data.
 Since then I have found tutorials and have successfully created/used databases solely from within Visual Web Developer. I'm assuming that Visual Web Developer includes a database engine, much like the webserver that is included. (This is an awesome thing).
 When I tried to upload my web application with database to my production server, the database would not work, it started working after I installed SQL Server Management Studio Express on the server.
 Is it my understanding that you need SQL Server Management Studio Express if you do not have Visual Web Developer Express installed in order to provide the data access engine?
Also, I am unable to "attach" my Visual Web Developer Express created database to SQL Server Management Studio Express. Are there any posts that provide more information about this topic?
 
The only reason I'm asking is that I have extra whitespace on the end of my text fields, and I thought ANSI_PADDING was turned on. I do not see the option in Visual Web Developer Express, but have found it in SQL Server Management Studio Express.

View 14 Replies View Related

Sql Server 2005 Express: Can't See [DatabaseMail] Node In Manamgent Studio's Object Explorer

Dec 10, 2007

I use Windows Vista Home Premium

Here's my Help About Info: Microsoft SQL Server Management Studio Express 9.00.3042.00
Microsoft Data Access Components (MDAC) 6.0.6000.16386 (vista_rtm.061101-2205)
Microsoft MSXML 3.0 4.0 5.0 6.0
Microsoft Internet Explorer 7.0.6000.16546
Microsoft .NET Framework 2.0.50727.1433
Operating System 6.0.6000

I opened up the Surface Area Configuration Tool and chose the "Surface Area Configuration for Features". Choose "Database Mail" and clicked the checkbox "Enable Database Mail Stored Procedures"

When I go into the Management Studio, I can't see the "Database Mail" node under "Management"
I'm thinking I might need a service pack as in the about, I don't see a service pack listed. BUT, when I go to the SQL Server 2005 Express "Service Pack 2" page, there's no option to just download the Service Pack. I recently downloaded (2 weeks ago or so) this Sql Server Express Edition and I'm thinking this might have Service Pack 2 already, but I'm not sure as I don't see it in the "about".

What should I do?

View 3 Replies View Related

Microsoft SQL Server 2005 Management Studio - Opening SQL-File From Explorer Does Not Connect Automaticly To Server/database

Apr 25, 2008

hello,

I have a question about opening files in the Microsoft SQL Server 2005 Management Studio.

In the old Query Analyzer from SQL 2000 I can open SQL Files via drag & drop (from explorer to QA) or open it with a double click in the explorer. Then the Files opened, if I had actual a connection to a server / database (QA is stared with one file and has a connection to Server/Datebase), with this connection.

Now in Microsoft SQL Server 2005 Management Studio I'll be asked everytime for Server and have to get the database from the database list - it does not connect automaticly to server/database, that is actual connected (I have opened a file with the connection and a connected database in the object explorer).

Someone do not have this problem - but we found no option to set it up.

Any ideas?

thanks &
best regards,
Christian Kiedels

View 9 Replies View Related

2005 Database Will Be Shown In Management Sudio Express Or App_Data/Database Explorer?

Feb 13, 2008

I have installed 2 SQL Server 2005 Express sample databases from 2 books, ASPnet 2.0 and ADOnet 2.0. The ASPNETDB.MDF was shown in App_Data and Database Explorer, but not in the SQL Server Management Studio Express. The AdoStepBy Step database created by a ConfigDB.exe was displayed in the Management Studio, but not in the App_Data, or Database Explorer.

Is this the way SQL Server 2005 runs the 2005 databases for SQL Server 2005 Express only? Or also in SQL Server 2005?

TIA,
Jeffrey

View 6 Replies View Related

SQL Server Management Studio Express (SSMSE)=&&>Object Explorer=&&>Databases Has C:SSMSE-BookChapter12WINCH12NORTHWND.MDF?

Feb 27, 2008

Hi all,

In my SQL Server Management Studio Express (SSMSE)=>Object Explorer=>Databases, the "NORTHWND" database was screwed up and is deleted completely. But under the same Object Explorer =>Databases, there is a database "C:SSMSE-BookChapter12WINCH12NORTHWND.MDF". I need to use this "NORTHWND" database in the SqlConnection. How can I specify the "Initial Catalog" (or "database") in the New SqlConnection code statement (in the ADO.NET 2.0-VB 2005 Express programming)?
Should it be like the following:

Dim sqlConnection As SqlConnection = New SqlConnction("Data Source=.SQLEXPRESS; Initial Catalog=C:SSMSE-BookChapter12WINCH12NORTHWND; Integrated Security=SSPI;") ? Or what is the right code statement for connecting to it?

Please help and advise.

Thanks in advance,
Scott Chang

View 7 Replies View Related

Server Explorer Different Than Management Studio Express

Jun 28, 2006

Using the starter kit, Personal Web Site, I start by adding a new user to the Administrator Role in the the the SQLExpress database by using the Graphical Web Administrator Tool .  Then, using the Personal Web Site application in Visual Studio 2005 (not the Web Developer Express 2005) , I  register a new account.  When I examine Server Explorer, I can see 2 users in aspnet_Membership and 2 users in aspnet_User tables.  However, when I use SQL Server Management Studio Express, I only see 1 user in both of those tables.  Is there a reason for this?

View 2 Replies View Related

Northwind Database In SQL Server Management Studio Express Is Lost Or Used/processed By VB 2005 Express:How To Locate/return It

Dec 3, 2007

Hi all,

In the last one and half years, I used the Northwind Database in SQL Server Management Studio Express (SSMSE) to learn the programming of SqlConnections, Data sources, Database Exploere, ADO.NET 2.0, etc. via VB 2005 Express.

The Northwind Database in my SSMSE got lost very often, but I was not aware of it. How can I know where the Northwind Database is used or processed by my VB 2005 Express projects that were the examples of some tutorial books or my trial projects? How can I release the Northwind Database back to my SSMSE from the VB 2005 Express projects? Please help and advise.

Thanks in advance,
Scott Chang

View 2 Replies View Related

Right Code Statements Of SqlConnection && ConnectionString For Connecting A Database In Database Explorer Of VB 2005 Express?

Feb 14, 2008

Hi all,

In the VB 2005 Express, I can get the SqlConnection and ConnectionString of a Database "shcDB" in the Object Explorer of SQL Server Management Studio Express (SSMSE) by the following set of code:
///--CallshcSpAdoNetVB2005.vb--////

Imports System.Data

Imports System.Data.SqlClient

Imports System.Data.SqlTypes

Public Class Form1

Public Sub InsertNewFriend()

Dim connectionString As String = "Data Source=.SQLEXPRESS;Initial Catalog=shcDB;Integrated Security=SSPI;"

Dim connection As SqlConnection = New SqlConnection(connectionString)

Try

connection.Open()

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

command.CommandType = CommandType.StoredProcedure
.......................................
etc.
///////////////////////////////////////////////////////
If the Database "shcDB" and the Stored Procedure "sp_inertNewRecord" are in the Database Explorer of VB 2005 Express, I plan to use "Data Source=local" in the following code statements to get the SqlConnection and ConnectionString:
.........................
........................

Dim connectionString As String = "Data Source=local;Initial Catalog=shcDB;Integrated Security=SSPI;"

Dim connection As SqlConnection = New SqlConnection(connectionString)

Try

connection.Open()

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

command.CommandType = CommandType.StoredProcedure
........................
etc.

Is the "Data Source=local" statement right for this case? If not, what is the right code statement for my case?

Please help and advise.

Thanks,
Scott Chang

View 6 Replies View Related

How Do I Adjust Object Explorer Filter Settings? - SQL Svr Mgt Studio 2005

May 7, 2008

My default filter settings are:          Name       Schema      Created
How do I add an additional filter such as 'Modified'?
I can get into the Filter Dialog box by clicking on the Funnel, but I can't figure out how to add another filter to the list.
 
-smc

View 3 Replies View Related

Calling Stored Procedures From ADO.NET-VB 2005 Express:1)Compile Errors && 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

Sql 2005 Registered Server Vs Object Explorer

Jun 12, 2006

Under sql 2000 I needed to register my sql server before I could begin working with it under Enterprise Manager. Under sql 2005 I usually setup the server under "Object explorer" and work with it from there. So what does registering a server under sql 20005 do? Why is it needed?





TIA,



barkingdog

View 4 Replies View Related

Database Explorer In VB Express:AdventureWorks.mdf-Files Do Not Match The Primary File Of The Database

Nov 5, 2007

Hi all,

I downloaded and ran AdventureWorks.msi into my SQL Server Management Studio Express (SSMSE) one year ago.But I did not know how to attach it to my SSMSE then. Last week, I deleted it from the "Add or Remove" of Control Panel and I downloaded the new AdventureWork.msi and installed it my SSMSE. Today, I tried to use the Database Explorer of VB 2005 Express for the first Stored Procedure programming. I clicked on AdventureWorks.mdf and I got the following error: One or more files do not match the primary of the database. If you are attempting to attach a database, retry the operation with the correct files. If this is an existing database, the file may be corrupt and should be restored from a backup. Cannot open user default database. Login failed. Login failed for user 'CENADe1enxshc'. Log file 'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataAdventureWorks_Data_log.ldf' does not match the primary file. It may be from a different database of the log may have been rebuilt previously. Please help and advise me how to correct this problem.

Thanks,
Scott Chang

View 9 Replies View Related

Sql Server 2005: Get A List Of All Configured Web Services In The Object Explorer

Oct 21, 2005

Hello,i have created some (test) Web Services in a Sql Server 2005 via theCreate Endpoint Statement. Now i look for a node in the "ManagmentStudio" where i can see these Web Services. But i dont found that. Whatis the plainest way to do that? What alternatives are existent?Thank you,Hans

View 2 Replies View Related

Trigger Does Not Show In SQL Express Object Explorer

Mar 15, 2007

Does anyone know why a trigger does not show in SQL Express object explorer?  It does exist. I can find it a couple of different ways (VIEW sys.triggers)... and it is working but if I cannot see it how can I modify it? Thank you.
Thank youMichael MooreSt Paul MN

View 2 Replies View Related

Cannot Connect To Localhost From Server Explorer In Visual Studio 2005.

May 14, 2007



hi ,



I am trying to connect to my local SQL server 2005 from "Server Explorer" but it is giving the error of "Remote Connectons" not allowed.



I am using "windows authentication" login.



My SQLExpress and SQLExpress browser are running from "SQL server configuration manager".



If i use a "App.Config" file to connect to database, the SQl connection can open and i can run the stored procedure.... but cannot access the database on my local machine.



Please help.



thanks for reply.

With regards,

Girish.

View 7 Replies View Related

Object Explorer And Object Explorer Details

Apr 23, 2008

SQL server 2005:
How to view or open tables under object explorer details, when i double click an object under object explorer.

thats how the default settings used to be.

now when i double click any object or try to open query analyzer it is open in the same left side pane on top of Object explorer window.

i did something to my explorer and explorer details panes since then both are separated, they are not getting synchronized.

Thanks for your help.

View 1 Replies View Related

How To Enable The Option Of Create New SQL Server Database From Database Explorer

Nov 10, 2006

Hi there

I am working on Visual Web Developer Express Edition 2005. When I right click on database explorer to create an SQL server database then I always find the option " Create New SQL Server database " Disabled.

Can any one tell me how to enable that option please ?

View 4 Replies View Related

SQL Server 2005 Is Not There In Server Explorer Of Visula Studio.NET

Jun 29, 2006

Hi,
I have installed express edition of the Visaul Studio and SQL Server 2005. But I am suprised to see that sql server is not there in server explorer of vs.net and also we create can not create the database in app_data server. It is giving error that Your default server setting does not alllow remote sql server database. What should i do to make it working. Also in ASP.NET configuration tool it it not working
please help me, its very urgent
regards,
Jalpesh

View 3 Replies View Related

Visual Studio Database File And SQL Server Management Studio Express Question

Mar 17, 2007

I have a database in my "App_Data" folder of my visual studio project.  I can view it fine in Visual Studio's built-in tools for managing a database attached to a solution.  However i recently started playing around with the SQL Server Management Studio Express program.  When i attach my database to Management Studio, and try to run my program it crashes.  I think it might be a permissions error?!? When i detatch it and reattach it in visual studio it runs fine again.   Any suggestions? ThanksJason 

View 1 Replies View Related

Regarding Connectivity Issues Of IBM U2 XML Database Using .net Server Explorer

Jan 9, 2008



Hi,

Im trying to connect IBM U2 XML Database using my ms.net Server explorer.but server not itself getting detected.

Prerequisites :i have installed the following things in my system
1. U2 on my machine and created databaes and tables.
2. IBM Database Add-ins for Vs.net 2005

below are the following steps im trying to connect IBM U2 Xml Database

1.Server Explorer ->Addconnection
Datasource : IBM DB2,IDS and U2 servers

2.in server tab its not showing my server which created using U2


Can any one please guide me in this issue









View 3 Replies View Related

Can't Save Server Names In Object Explorer

Jul 10, 2006

In Management Studio, under Registered Servers, I double-click a server name (could be sql 2000 or sql 2005 server) and it apperars in "Object Explorer" where I can work with it. I click the "Save All" button in Management Studio, exit Studio, and re-start Studio. When I do, I find that all the servers I placed under "Object Explorer" are now missing and I need to go through the "double-click the registered server" ritual again. And again, and again.

What am I doing wrong here? Why don't the servers "stick" in Object Explorer?

TIA



barkingdog



P.S. I have Sql 2005 SP1 installed on my box.

View 3 Replies View Related

Connect Object Explorer - SQL Server Mobile

Nov 23, 2006

Hi,

in Management Studio, for what purposes can i use the server type 'Sql Server mobile' in the menu Connect Object Explorer?

Thanks
SP

View 1 Replies View Related

Connecting SQL SERVER 2005 EXPRESS EDITION Using Server Explorer

Oct 17, 2007

Hi all.I use Visual Studio .NET 2002 and SQL Server 2005 Express Edition as database.I try to connect to database using server explorer.Test connection is OK. When I done with it and click OK, the message prompt that "Unable to connect to database".So, is it impossible to connect SQL Server 2005 Express Edition using the server explorer?But, the connection is ok when I connect through code cause I can retrieve and update database. 

View 2 Replies View Related

Sql Server Agent Option Doesnt Come Under The Object Explorer

Mar 22, 2007

I need to create a job and schedule it in sql server 2005.But the sql server agent option doesnt come under the database instance in the object explorer.Do I have to instal some other component of sql server 2005?

View 1 Replies View Related

Dbo.Table Of A Database In The .SQLEXPRESS Object Explorer: How To Copy The Dbo.Table To The Another Blank Dbo.Table?

Jan 9, 2008

Hi all,

The following dbo.Tables of Northwind.mdf in my .SQLEXPRESS (SQL Server Management Studio Express) are missing:
dbo.Categories
dbo.CustomerCustomerDemo
dbo.CustomerDemographics
dbo.Customers
dbo.Employees
dbo.EmployeeTerritories
dbo.Order Details
dbo.Orders
dbo.Products
dbo.Regions
dbo.Shippers
dbo.Suppliers
dbo.Territories.

But, I have these dbo.Tables in a different Database "xyzDatabase". How can I copy each of these dbo.Tables to the another blank dbo.Table of Northwind Database?

I right clicked on the dbo.Categories and I saw the following thing:
dbo.Categories
New Table...
Modify
Open Table
Script Table as |> CREATYE To |>
DROP To |>
SELECT To |>
INSERT To |> New Query Editor Window
File....
Clipboard
UPDATE To |>
DELETE to |>
From the above observation,I think it is possible to copy the dbo.Table from the one Database to the Northwind Database that needs to be repaired. Please help and advise me how to do this task or tell me where I can find the Microsoft document that gives the details of this X-copy thing.

Thanks in advance,
Scott Chang

P. S. I am using VB 2005 Express to create a project to learn "Calling Stored Procedures with ADO.NET" (see Paul Kimmel's article in http://www.developer.com/db/article.php/3438221) that needs the dbo.Tables of Northwind Database and my Northwind Database has been screwed up for quite a while and needs a big repair.

View 3 Replies View Related

Import Existing Database Into SQL SERVER EXPRESS Management Studio Express

Feb 18, 2008



Hi,

I am a newbie so i apologies beforehand for any mistakes i make on this forum.
Anyway, i created an asp.net website using the MS Visual Web developer tool. This has a couple of SQL SERVER databases within it.
I then latervinstalled the SQL SERVER management studio express in order to manage the SQL SERVER DBs that i had as part of my website but they do not appear within the management studio db list.
As this is the express version, is there anyway of importing the existing SQL SERVER dbs that i have to the management studio so i can manage them from there?

Regards,

Shuja.

View 5 Replies View Related

Why Can't I See My Web Developer Express Database From SQL Server Management Studio Express?

Apr 30, 2006

Hi, I'm completely new to SQL Server and ASP.NET, so please bear with me on my learning curve! I've installed Visual Web Developer Express and SQL Server Express (on the same PC). I then used Web Developer Express to successfully create a new database with a couple of tables in it. So far so good. I then installed SQL Server Management Studio Express on the same PC and tried to connect to my new database. The connection to the SQL Server instance appears to work OK (using Windows Authentication) but I can't see the database I previously created. All I can see are the System Databases. Does anyone know what the solution might be?

View 4 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

Trigger Work In VS Explorer - Not In Debug App - SQL Express 2005

May 6, 2008

OK I am really going nuts here. I have a trigger that will work if I insert a row using SQL MGMT Studio or VS DB explorer, but it will not insert using the tableadapter.update() command.

What is also strange is that I have to execute the query in the VS DB Explorer or SSMSE to get them to fill in the default values (trigger).

No matter what they don't work in the debug application:

Below is the trigger:



Code Snippet

ALTER TRIGGER [dbo].[weight_train_log_InsertTrigger]
ON [dbo].[weight_train_log]
AFTER INSERT
AS
BEGIN
SET NOCOUNT ON
UPDATE [weight_train_log]
SET [CreationDate] = GETDATE()
FROM inserted
WHERE inserted.[GUID] = [weight_train_log].[GUID]
END

View 1 Replies View Related

How Do I Export My Database From SQL Server Management Studio Express

Aug 9, 2007

HiI am using SQL Server Management Studio Express to make my databases but I noticed if I make my database in Visual studios and go new Item and make a new database I see it in app_data folder and server express tab and if I make it in SQL Server Management Studio Express I only see it in the server explorer. So if I have to move my files to another computer how do I move my database easly with SQL Server Management Studio Express? Since when you make it with the visual studio the file gets stored with all the other files of your project so if you move it all to another computer you prob won't run into a problem. So how do I make it that so I can do everything in SQL Server Management Studio Express(since I like working in it) then export it into a file that I can then go into my app_data folder and add it is an exist item?  Thanks 

View 1 Replies View Related

Database Snapshot In SQL Server Management Studio Express

Oct 16, 2007

How do I set up a database snapshot and backup the database for Windows Server Update Services 3.0, that uses the "desktop" version of SQL server on the same server running Widows Server 2003? There does not seem to be a "Management Plans" sub-folder under the "management" folder in the Management Studio Express console- so that's probably my first request- how do I establish a "Management Plans" subfolder, then how do I (step-by-step) set up a backup of the SUSDB?

View 21 Replies View Related







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