.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Velemoochi
Imran Ghani
Post New Web Links

SQL Database Creation Path

Posted By:      Posted Date: August 29, 2010    Points: 0   Category :Sql Server
 
Declare   @Path as varchar(500); Declare @mdfpath as varchar(500); Declare   @ldfpath as varchar(500); Set   @Path=(SELECT SUBSTRING(physical_name, 1,CHARINDEX(N'master.mdf',LOWER(physical_name)) -21) DataFileLocation FROM master.sys.master_files WHERE database_id = 1 AND FILE_ID = 1) set   @mdfpath=@Path+'\MSSQL.1\MSSQL\DATA\jjjj3.mdf'; set   @ldfpath=@Path+'\MSSQL.1\MSSQL\DATA\jjjj3_log.ldf';     CREATE DATABASE [jjjj3] ON PRIMARY ( NAME = 'jjjj3', FILENAME = @mdfpath , SIZE = 2048KB , FILEGROWTH = 1024KB )   LOG ON (   NAME = 'jjjj3_log', FILENAME = @mdfpath , SIZE = 1024KB , FILEGROWTH = 10%) The Above procedure creation error b'use of dynamic path of SQL, How to select Dynamic path to file name Thanks K. Govindaraj


View Complete Post


More Related Resource Links

SQL/MTS: Automating the Creation of COM+ Components for a Database Schema

  

Using Microsoft Windows DNA architecture as a guideline, it's possible to create scalable multitier database applications with COM+ and Microsoft Transaction Services. In fact, you can use existing table definitions to automatically build the MTS/COM+ business logic layer and data access components for your application. This article will walk you through the development of database transactions by mapping the transactions to automatically generated MTS/COM+ components. This technique can greatly simplify the task of creating components for a large project.

Aleksandr Mikunov

MSDN Magazine July 2000


Upload image to database - couldn't find file path

  
I'm trying to display images in a GridView (yes, still this...). [edit] Before I can come to that I have to upload some images to the database.I've followed this tutorial for the "upload image to database" code (this worked fine for uploading images, but I don't know if the images were converted to byte):http://aspsnippets.com/Articles/Save-Files-to-SQL-Server-Database-using-FileUpload-Control.aspxand I've followed this tutorial for the "display images in gridview" code (and "retrieve file" from the tutorial below).http://www.aspsnippets.com/Articles/Display-images-from-SQL-Server-Database-in-ASP.Net-GridView-control.aspxIt doesn't quite work, the GridView shows but without imagesNow I'm trying to change the "save file" code according to this tutorial:http://aspsnippets.com/Articles/Save-and-Retrieve-Files-from-SQL-Server-Database-using-ASP.Net.aspxbut I don't understand everything in it. When I try to upload an image I get an error on this line:FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read); //couldn't find file (path to image I tried to upload) What should I do about it?

Create a database in a different path

  
Hello, I want to add a database that will be stored in a different path than the default path. Is it possible or must I install a whole new instance of the SQL server and create the database there? Thanks.  

Path to sqlite database file

  
Hy,i want access to my database sqlite file from web.config file I've added connection string in web.config but my format is wrong. My database file existx in App_Data Folder.How to add path independet of drive, for example:<connectionStrings>         <add name="CROexport" connectionString="~\App_Data\CROexport.db3;Version=3;" providerName="System.Data.SQLite"/>     </connectionStrings><connectionStrings> <add name="Name" connectionString="~\App_Data\DbFile.db3;Version=3;" providerName="System.Data.SQLite"/> </connectionStrings>I want relative path?I've tried "../../App_Data/", "|App_Data|"

SQL Server - The database log is not available after creation

  

Hi all,

for our product we create a SQL Server database at install time. The first thing is: we create the database and the second: we create some tables in it. The queries for these actions are performed through SQL Server SMO API by the Database::ExecuteNonQuery function.

Sometimes we get the following error at the second step of creating the first tables in the new fresh database:
The log for database 'x' is not available. Check the event log for related error messages. Resolve any errors and restart the database.

It is not clear how to reproduce this situation. We already know that it can be solved manually by detaching and attaching the database or restarting SQL Server. However we perform automated tests on our product and thus we cannot do these things manually. Furthermore we don't want customers run into this problem. Do you know the cause of this problem or how to resolve it?

many thanx in advance


creation of multiple .aspx pages from database name

  


 hi ,
i am making an internal social networking application for my small organisation where i work  .i have a list of all employee  names in a mssql 2000 database that are the names of 5000 employees of the company  one by one arranged in rows in a single coloumn of a table . i have a folder ,i want to make  .aspx files/pages in that folder ,the file name should be same as names of the person in database coloumn.can any help me with codes to automatically make the .aspx pages with the same names as it is in database coloumn.(note that folder will not take any duplicate values(name will not be repeated)) .i am making application using asp.net 2.0.file will be automatically created in the folder as soon as new name is entered in database.its very difficult to make 5000 aspx page with each employee name and it will be difficult to make new pages again and again after new employees names are entered.so i want that files will be automatically created after employee names are registered.  


thanks in advance.

hoping for help for someone.


dynamic content database creation exception

  

Hi,
   For Creating a database dynamically  i created a webpart, but there will be an exception comes at runtime.Following  code shows the exception :

System.Security.SecurityException: Access denied. at Microsoft.SharePoint.Administration.SPPersistedObject.Update() at Microsoft.SharePoint.Administration.SPServer.Update() at Microsoft.SharePoint.Administration.SPPersistedObject.Update(Boolean ensure) at Microsoft.SharePoint.Administration.SPPersistedChildCollection`1.Add(T newObj, Boolean ensure) at Microsoft.SharePoint.Administration.SPPersistedChildCollection`1.Ensure(T newObj) at Microsoft.SharePoint.Administration.SPContentDatabaseCollection.Add(Guid newDatabaseId, String strDatabaseServer, String strDatabaseName, String strDatabaseUsername, String strDatabasePassword, Int32 warningSiteCount, Int32 maximumSiteCount, Int32 status, Boolean provision, Boolean allowUpgrade, Boolean flushChangeLog) at Microsoft.SharePoint.Administration.SPContentDatabaseCollection.Add(String strDatabaseServer, String strDatabaseName, String strDatabaseUsername, String strDatabasePassword, Int32 warningSiteCount, Int32 maximumSiteCount, Int32 status, Boolean provision, Boolean allowUpgrade) at Microsoft.SharePoint.Administration.SPContentDatabaseCollection.Add(String strDatabaseServer, String strDatabaseName, String strDatabaseUsername, String strDatabasePassword, Int32 warningSiteC

inserting path in database

  

Hi all, I'm trying to insert the image path into database so that i can retrieve it for reference in the future in my website.

I've got some problem with this code, which i've found and converted using a convertor.

And other than this, what are the stuff I have to do related to the database structure in order to get this code working?


Imports System.Data

Partial Class _Default
    Inherits System.Web.UI.Page
    Private Sub StartUpLoad()


        'get the file name of the posted image

        Dim imgName As String = FileUpload1.FileName.ToString()

        'sets the image path

        Dim imgPath As String = "ImageStorage/" & imgName

        'then save it to the Folder

        FileUpload1.SaveAs(Server.MapPath(imgPath))



        'get the size in bytes that

        Dim imgSize As Integer = FileUpload1.PostedFile.ContentLength



    

Database creation for System Center Operations Manager 2007

  
I want to install System Center Operations Manager, and create the database in SQL Server 2008 R2 that is hosted on a different server, the problem is telling me that the version of SQL does not match the version that SCOM needed.
I tried putting SP1 and SQL 2008 SP2 to R2, but not let me.
It says that "The version of the instance of SQL Server Shared Component does not match the version expected by the SQL Server. The version of SQL Server product is installed 10.50.1600.1 and awaited version of SQL Server is 10.0.1600.22. "
I think it's the version of SQL.

Marta

How to upload a file to web server in asp.net and store file path into database table?

  
This article describe how to upload a file into web server folder using asp.net file upload control and store the file information into sql server database.

Multiple database support with Entity Framework

  
One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Export Visio Database Table Names to Excel

  
If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

MS SQL Server: Disconnect Users From Database - Kill User Session

  
If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

Publishing SQL Server Database using Publishing Wizard : Tips & Tricks

  
We can use SQL Server Publishing Wizard to deploy our local Database to remote hosting server/production server.This feature is available in SQL Server 2008/VWD 2008.

Below is the complete step by step guide of this process.

Adding Rows in GridView without using a Database

  
This article describes on how to add rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in the TextBox on Button Click and retain the GridView data on post back.

Adding Multiple Columns and Rows in GridView without using a Database

  
This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.

ASP.NET Database Tutorial

  
This tutorial will show you how to display data using the .NET GridView Control, ASP.NET 2.0 and VB.NET

The GridView control is a powerful tool and is simple to implement.

First, you will need to import the System.Data.SqlClient namespace.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend