How Do I Upload To And Download From A Shared SQL Server 2005 Database?
My hosting gives me ASP.NET 2.0 and a shared SQL Server 2005 package.
I have Visual Studio 2005 on my machine - which installs SQL Server 2005 Express. I have also installed SQL Server 2005 Management Studio Express.
I wish to develop my database locally (mdf file) as I won't always have internet access (and therefore can't always work directly with the remote shared database).
My question is, how do I upload my database info from my local machine to my remote shared database?
Also I shall wish to download my remote database to my local machine in order to work on the database (and then be able to re-upload it) sometimes.
Please can somebody tell me how I can do this?
Will SQL Server 2005 Management Studio Express permit me to do this and if so how?
If I need the full version of SQL Server 2005 Management Studio then I do have SQL Server 2005 and this install with it (but it all looks a bit complicated to install for me).
Many thanks for all help given,
Graham
View Complete Forum Thread with Replies
Related Forum Messages:
Shared Hosting - How Do You Upload/download Your Database?
Hello, I am an ASP.NET 2.0/SQL 2005 web developer, and I have run into a huge frustration for some time now that I can't seem to get past. My goal is to develop SQL databases for my costomers on my development machine, and then upload the completed database out to my host. I have not found a host that allows this yet. Some hosts do not allow remote SQL connections altogether, and the best hosts I have been able to find allow remote SQL connections, but do not allow SSIS or DTS packages to run to transfer database objects to the production server. What does this mean? Well, I have to manually transfer or recreate individual stored procedures and recreate primary, foreign, and other table constraints. I cannot just run a DTS package to transfer the completed objects. So this means duplicating effort, changes for mistakes, and more server downtime during site upgrades. I have called so many host providers, and I haven't found one that can get me past this. Also, I contacted Microsoft to ask about Licensing (thinking I would just lease a dedicated server), and the only option I can use is SPLA licensing. The catch, I have to lease the OS through SPLA as well, and all the hosts I have contacted put the OS on the server themselves. This means I would be paying for the OS twice. Ideally, I would just love to find a shared web host package that I could use efficiently with my SQL development. Am I missing something? If anyone has any advice, please help! I would be so appreciative!!! Thanks. Regards, Jeremy
View Replies !
How Do You Upload And Download Images And File From Database?
Hi, how do i upload and download images and files from database row?is there anyway i can upload images so that uploaded images ares saved in a listbox and at the same time in the IMAGES folderin the solution explorer as well so that i can later select an image fromlistbox and download it when needed? i m using c#,vwd2005 express,sql express. thanks. jack.
View Replies !
Upload (or Download) A File Into (or From) A MS SQL Server DB
I would like to design a content-management feature on a website, in particularbe able to upload a binary file and to store it into a MS Sql Server DB.be able to download it afterwards. The sizes of the files are very limited (less than 100Kb) so I do not need any special feature to handle the upload/download.Does anyone know how to achieve such feature?Thanks in advance,Joannes
View Replies !
How To Upload My Express Database To Remote Sql 2005 Server
I have make a website with asp.net 2.0, but I only have a PC with Window 98 connect to Internet. so I can't upload my express database to remote sql 2005 server with SSManagement Studio How can I do? I heard that SSManagement Studio Express version can't upload database,right? I find the site http://www.vwdhosting.net/ can upload my express database and attach to sql 2005 server easily, but some big hosting provider such as http://www.discountasp.net require us upload express database using SSManagement Stud! Where can I find a hosting provider who can attach express database easily?
View Replies !
Upload/download BLOB Files
i have a question. i am using BLOB to store reports into my SQL Server Database. I have mastered how to save the file to the DB and read in back to the browser. my question is that the code i have will only open up the file that is specified in the code. each report is stored in a field called Report corresponding to an event with a unique eventID.The reports can be of any type i.e. word, excel or PDF (most likely limited to these 3 types). is it possile to read a report from the DB without explicitly specifying the fielname hard coded into the code?? you see i will be reading the report corresponding to an event into a textbox field. it will be the full path and then if a user clicks another button the report will open in a seperate window. I need to be able to open up any report with any extension from the click of a button. does anyone have any advice/artcicles on how i can achieve this please? Any help appreciated.Thanks
View Replies !
Merge Replication, Subscriber Can Only Download But Not Upload??
Hi, I need a urgent help! The problem is that every synchronization only transfer data from subscriber to publisher, but not the other direction. The publisher is sql server 2005 standard edition, and the subscriber is 2005 express. Is that any stored-procedure to deal with such a problem? Thanks for any commnet.
View Replies !
Can Multiple Workstations Running SQL 2005 Server Express Attach To The Same Database Files On A Shared Network Location?
Can multiple instances of SQL 2005 Express attach to the same database files on a network share? I have seen this done before with MSDE where the database files are stored on the server, but instead of having a SQL server running on the network and then connecting to it, only the database files exist on the network share and the users connect through MSDE running on the local machine. Is this possible with SQL2005Express? I do not have the ability to share an SQL instance from one workstation to another nor do I have the ability to install an instance on the corporate server. Is it as simple as creating the database and storing the files on the share then attaching the database to the SQL Instance on each workstation?
View Replies !
SQL 2005 Express Database Upload(help!)
Hi, how are you! I'm a beginner of database. I have some really "novice" questions here. Currently I'm trying to upload my database to a share windows host server. I have problems uploading my database files. I'm using Visual Studio 2005 and SQL 2005 express version. I was told that in order to upload my database, I need to have.bak file of my database. The problems are: 1. under my visual studio server explorer, it seems I have two databases, one is ASPNETDB.MDF, another one is (mycomputername)sqlexpress.(databasename).dbo. I dont know from which one I can create the .bak file, and how? 2. I can not find where the phsyical location of my files (such as tables or stored procedures) from my (mycomputername)sqlexpress.(databasename).dbo database. Anyone can help? thank you!
View Replies !
Using Sql Server 2005 In Shared Pc.
HI, currently two people(with different username and password) are using a shared workstation, where in the sql server is installed. so i just wanted to know that whether two people could use the sql server at the same time. please note that the two people have different username and password to enter to log in. Thanks, Nitin
View Replies !
Upload SQL Database To Server
Okay, I am still really new at this so nobody laugh if this seems simple stupid. I created a little web page and while working on the project created a new database by right clicking on my app and clicking "Add New item" then choosing SQL Database. I added tables and everything was working just dandy on my machine. I FTP'd the files up to my web server and am now getting an error. SQL is installed on the server, but I have a couple of questions.1. Does SQL have to be installed on the server if you create one of these databases by doing the Add New Item button?2. After Uploading it to a server with SQL installed, the database shows in my App Data folder, but gives me an error. What needs done to move this database to the server besides uploading it?Here is my error:An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
View Replies !
How To Upload MSDE Database To Server??
Hello everyone, I've got a simple yet concerning problem. How do I get the MSDE database I've created off my PC and onto the web server? I've thought of doing a "BACKUP DATABASE dbname TO DISK = 'blah,blah'", then upload it and hope I have permissions to execute a DATABASE RESTORE... Any other methods?
View Replies !
Ms Access Upload To SQL Server 2005 BE && Sharepoint FE
I have about 20 Ms Access Databases to need to be upload onto a SQL Server2005.Currently the are on a network/server residing on a specific drive. The goalis to keep the user face the same (ms access) and put all of the tables ontoa SQL Server 2005 BE, and yet make those databases accessible to open/viewthrough Ms Sharepoint.What is the simple (properties) way to grab all of those db's = 20 and uploadto server?With out having to write code.Pull all db's over to SQL then store the Ms Access databases on Sharepointwhere the user face remains the same and the tables are on the server and thedb's are accessible now through the company Intranet.--Message posted via http://www.sqlmonster.com
View Replies !
Upload Data From ACCESS To Sql Server 2005
I want to upload data from ACCESS database( contains more than 60 tables) to SQL server 2005 database( same table structure). If I use the method of copying table by table and Recordset to Recordset, It takes TOO long ( like 8 hrs). Could you pls suggest me the efficient way of doing this task. I heard something like DTS for this.But I never used this.. help me Thanks Goldie
View Replies !
How To Upload The MSDE Database To Web Hosting Server
Hi friends,I have made one application with database in MSDE and asp.net. I am handling the MSDE database with Access 2003. Now I want to upload the whole website to web server. I have uploaded all the asp.net files with dlls and every thing except Database.I don't know how to upload the Database from MSDE on local machine to web hosting server. Do I have to get the additional username and pass from the web hosting service provider or my FTP details will do and How..Thanking you.Mustaq
View Replies !
SQL Server 2005 June CTP Download Link
The first public beta of SQL Server 2005 is available for download. Try the link below and happy coding.http://www.microsoft.com/downloads/details.aspx?FamilyId=DC02CBB3-D688-4663-9103-37C83E044D59&displaylang=en
View Replies !
Can;t Download SQL Server 2005 Trial Edition
I want to download SQL Server 2005 Trial Edition, but i always meets problem in the last step. it displays: <<We€™re sorry, but there is no Microsoft.com Web page that matches your entry. It is possible you typed the address incorrectly, or the page may no longer exist. You may wish to try another entry or choose from the links below, which we hope will help you find what you€™re looking for.>> Who can tell me the way to download it? Thanks!
View Replies !
Can't Find SQL Server 2005 Evaluation Download
Hi, I found the proper page for download of the SQL Server 2005 Evaluation and I went through the steps of registering, setting up an account, etc. When I am redirected back to the page where I can theoretically now download the installation, there are two downloads available: ReadmeSQL2005.htm and RequirementsSQL2005.htm - But not the actuall installation file. Am I missing something, ot is something just missing? Joe
View Replies !
How Do I Launch SQL Server 2005 Express After Download?
Looks like I sucessfully downloaded SQL Server Express Edition w/Advanced Services SP2 on my Vista-based notebook. Took care of the prerequisites from downloading with Vista. I see the Configuration Manager, and Error and Usage Reporting. But......How do I launch SQL Server Express please? Thank you! Sandra Shokite
View Replies !
SQL Server 2005 Trial - Which File To Download?
Hi all, I am extracting SQL server 2005 trial edition to my flash memory hard drive. Hence suppose I should download one of the following three files: "Self-extracting executables: X86 Executable X64 Executable IA64 Executable " But which one should I choose? based on what criteria ? (This point seems clear to everyone but myself, even after I went through all the docs on the download site) Thanks, Jack (an absolute beginner)
View Replies !
Download File That Is Stored In Sql Server Database
Hi, I have tried to implement file download option. I can download file which is stored in any folder. Code is... string filepath = Request.Params["file"].ToString(); string filename = Path.GetFileName(filepath); Response.Clear(); Response.ContentType = "image/gif"; Response.AddHeader("Content-Disposition", "attachment; filename=" + filename); Response.Flush(); Response.WriteFile(filepath);This code is working fine. But now I am facing a problem. Files (not the path) are stored in database table. User can download file from the database. How can I do this? The file may be a .txt, .doc, .xls, .jpg or .gif.
View Replies !
Is The SQL Server 2005 Express Toolkit Download Corrupt?
I have now tried to download this several times and each time I get a "Extraction failed | File is corrupt" dialog midway through the extraction. Each time it is corrupt in the same place, UNTIL I re-download it, when it is corrupt in a different place! I've tried using the -x switch to extract to different disks. No difference there - so not a disk error. I could download and extract "SQLEXPR_ADV.EXE" fine. The forums seem to offer no hope here either.
View Replies !
Need MSSQL Server 2005 Enterprise Edition Download
Hi Dudes, I need a clean link for MSSQL Server 2005 Enterprise Edition download except Microsoft site. I already downloaded from it, burned the downloaded image, but the problem is that sql.cab and some other cab files got corrupted and some components became unable to install. I tried and installed it without some components. So anybody can help me in getting a proper link. And one more thing, i downloaded from the microsoft site itself with file size around 890MB. So give me link which works 100% or those who have tried and got 100% result. Thanx, BP.
View Replies !
SQL Server 2005 Reporting Services Error, Hotfix Download?
Hello I am attempting install CRM Server 3.0 R2 using SQL Server 2005 SP2. On install of CRM Server 3.0 R2 I receive a SQL Server reporting services error: Setup failed to validate specified Reporting Services Report Server http://jupiter/reportserver. Error: The feature: "Customizing security roles" is not supported in this edition of Reporting Services. There is a hotfix available here: 935922 But how can I get the hotfix and why is this hotfix not simply available for download as per other bug fixes? Now stcuk with no way to move forward. BTW anyone who has SBS2003 R2 and wants to get CRM server/client setup to work with Outlook 2003 and Vista read here 935922 But how can I get the hotfix and why is this hotfix not simply available for download as per other bug fixes? Now stcuk with no way to move forward. BTW anyone who has SBS2003 R2 and wants to get CRM server/client setup to work with Outlook 2003 and Vista read here http://www.teknobot.co.uk/archives/category/tech. Its better than any other MS article Ive found so far. Why MS realease action pack software that simply do not work with each other is beyond me, SBS always gets the dirty end of the stick. Any help would be greatly appreciated.
View Replies !
SQL SERVER EXPRESS BETA1 (2005) IS NOT RUNNING :SHARED MEMORY Provider Error
I'm facing several problems that I tryied to short out by msdn but could not get solution I'm using visual studio .NET 2005 Beta(WHIDBEY),and problem:1 sql server2005 Express edition is not running on My stand alone machine(AMD Athlon Xp 2000+,512 MB DDR Ram,CPU Clock speed 1.67 GHz) Whenever I try to connect to SqlExpress using the server explorer in the VisualStudio.NET 2005 using follwing option in connection properties Dialog Box : 1.server name: the name of my computer(I'm using the Default Instance of SQLEXPRESS 2005) 2.Enter Information to log on to the server:usewindowsNt Integrated Security3.when I go to select the inuilt data base like masters it gives following Error message:- "Shared memory provider:Specifed Module could not be Found" problem:2In the process of making of Data Access component,I made an assembly named "TNB.DataLayer.CSharp.dll" and putted it at two place one in the ..in folder and another in the folder having the solution file .Now I want this asssenbly to put in Global Assembly cache so that parts of my project (a window Application and a Web Application) can access the database using this TNB.DataLayer.CSharp.dll Now i need to make my assembly a strong name so I used following at the .NET command Prompt sn.exe -k TNBKeyPair.snkand put this file in the folder where My solotion .sln file exist.now as I have the keypair file,I tryied to sign the assembly TNB.DataLayer.CSharp.dll with this key for this when I added the following in to the AssemblyInfo.cs file[assembly: AssemblyKeyFileAttribute("TNBKeyPair.snk")] warning on bulding the solution is Warning 1: Use command line option '/keyfile' or appropriate project settings instead of 'AssemblyKeyFileAttribute' D:gopaldot net newTNBTNBPropertiesAssemblyInfo.cs 19 11 and when I use the /keyfile:TNBKeyfile at the command prompt I got another Error message:The file name, directory name, or volume lable syntax is incorrect. and finally I'm not able to sign the Dll and to put it in global assembly to use from different envioronments. so please help me in solving this problem. Thanks! ur faithfully
View Replies !
Server Error: Object Reference Not Set To An Instance Of An Object. Trying To Upload Image In Database
Does any one has any clue for this error ? I did went through a lot of articles on this error but none helped . I am working in Visual studie 2005 and trying to upload image in sql database through a simple form. Here is the code using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using System.Web.Configuration; using System.IO; public partial class Binary_frmUpload : System.Web.UI.Page {protected void Page_Load(object sender, EventArgs e) { }protected void btnUpload_Click(object sender, EventArgs e) {if (FileUpload.HasFile == false) { // No file uploaded!lblUploadDetails.Text = "Please first select a file to upload..."; } else {string str1 = FileUpload.PostedFile.FileName; string str2 = FileUpload.PostedFile.ContentType; string connectionString = WebConfigurationManager.ConnectionStrings["GSGA"].ConnectionString; //Initialize SQL Server Connection SqlConnection con = new SqlConnection(connectionString); //Set insert query string qry = "insert into Officers (Picture,PictureType ,PicttureTitle) values(@ImageData, @PictureType, @PictureTitle)"; //Initialize SqlCommand object for insert. SqlCommand cmd = new SqlCommand(qry, con); //We are passing Original Image Path and Image byte data as sql parameters. cmd.Parameters.Add(new SqlParameter("@PictureTitle", str1)); cmd.Parameters.Add(new SqlParameter("@PictureType", str2));Stream imgStream = FileUpload.PostedFile.InputStream; int imgLen = FileUpload.PostedFile.ContentLength;byte[] ImageBytes = new byte[imgLen]; cmd.Parameters.Add(new SqlParameter("@ImageData", ImageBytes)); //Open connection and execute insert query. con.Open(); cmd.ExecuteNonQuery(); con.Close(); //Close form and return to list or images. } } } Object reference not set to an instance of an object. 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.NullReferenceException: Object reference not set to an instance of an object.Source Error: Line 32: Line 33: string str2 = FileUpload.PostedFile.ContentType; Line 34: string connectionString = WebConfigurationManager.ConnectionStrings["GSGA"].ConnectionString; Line 35: Line 36: //Initialize SQL Server Connection Source File: c:UsersManojDocumentsVisual Studio 2005WebSitesGSGABinaryfrmUpload.aspx.cs Line: 34 Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.] Binary_frmUpload.btnUpload_Click(Object sender, EventArgs e) in c:UsersManojDocumentsVisual Studio 2005WebSitesGSGABinaryfrmUpload.aspx.cs:34 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
View Replies !
Using Batch File To Download Flat File From Ftp Server So Can Bulkcopy Into Database
I use RUMBA and write FOCUS programs to pull data from our mainframe so I can then import the flat file into our Data Warehouse. I'm trying to eliviate some steps here and want to include the downloading of the flat file from the FTP Server to my server where I can then continue with the rest of the batch file and bulkcopy the data into my Data Warehouse. I can't figure out what code to use in the batch file to do that though. Can anyone help me please? I need help with the batch code to ftp the file to my server. Thanks! Jennifer
View Replies !
Upload Database
I created a website a year ago. I remember I need to download something from Microsoft (some kind of sql admin thing), which allows me to convert my database in the Express Visual Web developer to sql file, then I can copy those sql commands into my web hosting company's sql admin window to upload the database online. I forgot what things I should download from Microsoft? Please help.
View Replies !
About XML Upload To Database
HI Can anyone tell me how to upload a xml file in a table.I have uploaed text,csv,xel file but never xml. just want to know how to upload, and when,why should we use xml file for data thanks sandipan
View Replies !
Cannot Connect To Shared Database
Using Vista, when I start Outlook 2007 I get the following message: Business Contact Manager for Outlook could not connect to the shared database.//looking for msslbiz Do you want to work offline? I click Continue and get the messagebox: Business Contact Managerdatabase cannot be loaded This action cannot be completed because Business Contact Manager cannot access the database. The database is currently stopped. Do you want to change the database configuration? i say Yes and the messagebox says Microsoft Windows Search Protocol Host has stopped working. A problem cause the program to stop working correctly. Windows will close the program and notify you if a solution is available. I close program (no choice) and message says: Cannot find the selected database. Verify that the network and the computer on which the databases are located are available, and that you have permission to access the database, and then retry. Connect to computer name prompt does not work Create new database does not work Database creation was unsuccesful Using MS SQL Server Management Studio Express) to connect to msslbiz SQLServer does not allow remote connections (when trying to conect to Note that SqlServer Express is started and running on the Vista machine, and the databases I create are available to other machines on my lan. I cannot find a way to enable remote connections on msslbiz. Any help would be greatly appreciated.
View Replies !
2005: T-SQL To Download?
Hello,I am learning T-SQL of SQL 2005. I tried to find a good tutorial of T-SQLbut I failed. Could you recommend me something?Please help. thank you/RAM/
View Replies !
Sql 2000 Upload To A 2005 Sql DB?
Hi all, I am using ixwebhosting.com for a host and they say they are using sql 2005 servers, well any ways I have sql 2005 express edition, and sql 2000, I am able to export data from mysql2005 express using my 2000, but am having issues tryig to upoad the data to the 2005 sql server on the web host company. Any ideas on how to fix this or a workaround would be nice.Thanks All Jonny
View Replies !
2005 SQL How To Upload New Table
I use to have Enterprise Manager and had no problem uploading new table. But I downloaded 2005 SQL Server Management Studio Express adn I can't figure out how to upload... How do you upload new tables to my database using 2005 SQL? Thanks
View Replies !
How Can I Download From From Database?
Hi. I'm trying to make a web application let people publish documents from the internet. Now I've found a template source code let me upload file to SQL database (to an image field). Here the problem is I can't find source code to download binary data from the database. Could anyone help me? (Or tell me where can I found the resources teach me how to do that.)
View Replies !
How Do I Upload A MSDE Database
Downloaded and installed MSDE and just finished creating a website using the Community Starter Kit. I'm used to working with Access Databases and this is my first experience with anything SQL. Can someone provide my with some guidance as to what I need to do to upload the MSDE Database to a server. Can I just upload the files like an Access Database or is this more involved. Thanks for you help.
View Replies !
Upload Image To SQL Database
I am creating a update, delete, edit form for my web database. The form works in everyway except that when I try to upload the image to the database it does not go into the database. (I know the pros and cons of storing images in a database. In this instance it is what makes the most since. ) I have to admit I have never uploaded anything to my server or database before (other than plain text). I have read through several articles and have a high level of understanding. I found an example on a website that used the OnInserting/OnUpdating command. But it is not working. I tried to find another similar example so that I could better understand it and try to fix what must be wrong. I can't find a similar example. I am posting the code I have below. Any help would be most appreciated. C# Code Behind using System; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class html_Test_Default3 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void DetailsView1_ItemUpdated(Object sender, System.Web.UI.WebControls.DetailsViewUpdatedEventArgs e) { Response.Redirect("GridViewMasterDetailsInsertPage_cs.aspx"); } protected void DetailsView1_ModeChanging(Object sender, System.Web.UI.WebControls.DetailsViewModeEventArgs e) { if (e.CancelingEdit == true) { Response.Redirect("GridViewMasterDetailsInsertPage_cs.aspx"); } } protected void SqlDataSource3_Inserting(object sender, SqlDataSourceCommandEventArgs e) { FileUpload stateTextBox = (FileUpload)DetailsView1.Rows[2].Cells[0].Controls[1]; System.IO.Stream inputStream = stateTextBox.PostedFile.InputStream; int imageLength = stateTextBox.PostedFile.ContentLength; byte[] imageBinary = new byte[imageLength]; int inputRead = inputStream.Read(imageBinary, 0, imageLength); byte[] imageData = imageBinary; System.Data.SqlClient.SqlParameter uploadData = new System.Data.SqlClient.SqlParameter("@photo", System.Data.SqlDbType.Image); uploadData.Value = imageData; e.Command.Parameters.Add(uploadData); } protected void New_Click(object sender, EventArgs e) { DetailsView1.ChangeMode(DetailsViewMode.Insert); } } *************************************ASPX page <%@ Page Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true" CodeFile="DetailsViewEdit_cs.aspx.cs" Inherits="html_Test_Default3" Title="Untitled Page" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <form id="form1" runat="server" method="post" enctype="multipart/form-data"> <asp:DetailsView DefaultMode="Edit" AutoGenerateRows="False" DataKeyNames="recID" DataSourceID="SqlDataSource3" HeaderText="Edit Articles" ID="DetailsView1" runat="server" Width="275px" OnItemUpdated="DetailsView1_ItemUpdated" OnModeChanging="DetailsView1_ModeChanging"> <Fields> <asp:BoundField DataField="recID" HeaderText="Record Number" SortExpression="recID" ReadOnly="True" /> <asp:TemplateField SortExpression="LiveAccess" HeaderText="LiveAccess" > <EditItemTemplate> <asp:DropDownList ID="DropDownList1" AppendDataBoundItems="true" runat="server" DataSourceID="SqlDataSource3" DataTextField="LiveAccess" DataValueField="LiveAccess" SelectedValue='<%# Bind("LiveAccess") %>'> <asp:ListItem Text="Yes" Value="Yes" /> <asp:ListItem Text="No" Value="No" /> </asp:DropDownList> </EditItemTemplate> </asp:TemplateField> <asp:TemplateField SortExpression="DevelopmentAccess" HeaderText="DevelopmentAccess" > <EditItemTemplate> <asp:DropDownList ID="DropDownList2" AppendDataBoundItems="true" runat="server" DataSourceID="SqlDataSource3" DataTextField="DevelopmentAccess" DataValueField="DevelopmentAccess" SelectedValue='<%# Bind("DevelopmentAccess") %>'> <asp:ListItem Text="Yes" Value="Yes" /> <asp:ListItem Text="No" Value="No" /> </asp:DropDownList> </EditItemTemplate> </asp:TemplateField> <asp:TemplateField SortExpression="MediaAccess" HeaderText="MediaAccess" > <EditItemTemplate> <asp:DropDownList ID="DropDownList3" AppendDataBoundItems="true" runat="server" DataSourceID="SqlDataSource3" DataTextField="MediaAccess" DataValueField="MediaAccess" SelectedValue='<%# Bind("MediaAccess") %>'> <asp:ListItem Text="Yes" Value="Yes" /> <asp:ListItem Text="No" Value="No" /> </asp:DropDownList> </EditItemTemplate> </asp:TemplateField> <asp:TemplateField SortExpression="DoctorAccess" HeaderText="DoctorAccess" > <EditItemTemplate> <asp:DropDownList ID="DropDownList4" AppendDataBoundItems="true" runat="server" DataSourceID="SqlDataSource3" DataTextField="DoctorAccess" DataValueField="DoctorAccess" SelectedValue='<%# Bind("DoctorAccess") %>'> <asp:ListItem Text="Yes" Value="Yes" /> <asp:ListItem Text="No" Value="No" /> </asp:DropDownList> </EditItemTemplate> </asp:TemplateField> <asp:TemplateField SortExpression="DealerAccess" HeaderText="DealerAccess" > <EditItemTemplate> <asp:DropDownList ID="DropDownList5" AppendDataBoundItems="true" runat="server" DataSourceID="SqlDataSource3" DataTextField="DealerAccess" DataValueField="DealerAccess" SelectedValue='<%# Bind("DealerAccess") %>'> <asp:ListItem Text="Yes" Value="Yes" /> <asp:ListItem Text="No" Value="No" /> </asp:DropDownList> </EditItemTemplate> </asp:TemplateField> <asp:BoundField DataField="ContentType" HeaderText="ContentType" SortExpression="ContentType" /> <asp:BoundField DataField="ProductType" HeaderText="ProductType" SortExpression="ProductType" /> <asp:BoundField DataField="ReviewDate" HeaderText="ReviewDate" SortExpression="ReviewDate" /> <asp:BoundField DataField="ReleaseDate" HeaderText="ReleaseDate" SortExpression="ReleaseDate" /> <asp:BoundField DataField="ObsoleteDate" HeaderText="ObsoleteDate" SortExpression="ObsoleteDate" /> <asp:TemplateField HeaderText="Title"> <EditItemTemplate> <asp:TextBox id="EditTitle" Text='<%# Bind("Title") %>' Runat="Server" TextMode="SingleLine" Rows="1" Width="400px" Font-Size="9pt"/> </EditItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Sub Title"> <EditItemTemplate> <asp:TextBox id="EditSubtitle" Text='<%# Bind("Subtitle") %>' Runat="Server" TextMode="SingleLine" Rows="1" Width="400px" Font-Size="9pt"/> </EditItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Copy"> <EditItemTemplate> <asp:TextBox id="EditCopy" Text='<%# Bind("Copy") %>' Runat="Server" TextMode="MultiLine" Rows="5" Width="400px" Font-Size="9pt"/> </EditItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Keywords"> <EditItemTemplate> <asp:TextBox id="Keywords" Text='<%# Bind("Keywords") %>' Runat="Server" TextMode="MultiLine" Rows="5" Width="400px" Font-Size="9pt"/> </EditItemTemplate> </asp:TemplateField> <asp:ImageField DataImageUrlField="Picture"></asp:ImageField> <asp:TemplateField HeaderText="Image"> <ItemTemplate> <asp:FileUpload ID="FileUpload1" FileName='<%# Bind("Picture") %>' runat="server" /> <asp:RequiredFieldValidator ID="FileUploadValidator" ControlToValidate="FileUpload1" runat="Server">*</asp:RequiredFieldValidator> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Notes"> <EditItemTemplate> <asp:TextBox id="EditNotes" Text='<%# Bind("Notes") %>' Runat="Server" TextMode="MultiLine" Rows="5" Width="400px" Font-Size="9pt"/> </EditItemTemplate> </asp:TemplateField> <asp:BoundField DataField="WriterName" HeaderText="WriterName" SortExpression="WriterName" /> <asp:BoundField DataField="WriterEmailAddress" HeaderText="WriterEmailAddress" SortExpression="WriterEmailAddress" /> <asp:BoundField DataField="Language" HeaderText="Language" SortExpression="Language" /> <asp:CommandField ShowEditButton="True" /> </Fields> </asp:DetailsView> <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:myConnection %>" SelectCommand="SELECT [recID], [Date], [LiveAccess], [DevelopmentAccess], [MediaAccess], [DoctorAccess], [DealerAccess], [ContentType], [ProductType], [Title], [Subtitle], [ReviewDate], [ReleaseDate], [ObsoleteDate], [Keywords], [Picture], [Copy], [Notes], [WriterName], [WriterEmailAddress], [Language] FROM [Articles] WHERE ([recID] = @recID)" UpdateCommand="UPDATE [Articles] SET [LiveAccess]=@LiveAccess, [DevelopmentAccess]=@DevelopmentAccess, [MediaAccess]=@MediaAccess, [DoctorAccess]=@DoctorAccess, [DealerAccess]=@DealerAccess, [ContentType]=@ContentType, [ProductType]=@ProductType, [Title]=@Title, [Subtitle]=@Subtitle, [ReviewDate]=@ReviewDate, [ReleaseDate]=@ReleaseDate, [ObsoleteDate]=@ObsoleteDate, [Keywords]=@Keywords, [Picture]=@Picture, [Copy]=@Copy, [Notes]=@Notes, [WriterName]=@WriterName, [WriterEmailAddress]=@WriterEmailAddress, [Language]=@Language WHERE [recID] = @recID" OnUpdating="SqlDataSource3_Inserting"> <SelectParameters> <asp:QueryStringParameter Name="recID" QueryStringField="ID" Type="String" /> </SelectParameters> <UpdateParameters> <asp:Parameter Name="LiveAccess" Type="String"/> <asp:Parameter Name="DevelopmentAccess" Type="String" /> <asp:Parameter Name="MediaAccess" Type="String" /> <asp:Parameter Name="DoctorAccess" Type="String" /> <asp:Parameter Name="DealerAccess" Type="String" /> <asp:Parameter Name="ContentType" Type="String" /> <asp:Parameter Name="ProductType" Type="String" /> <asp:Parameter Name="Title" Type="String" /> <asp:Parameter Name="Subtitle" Type="String" /> <asp:Parameter Name="ReviewDate" Type="String" /> <asp:Parameter Name="ReleaseDate" Type="String" /> <asp:Parameter Name="ObsoleteDate" Type="String" /> <asp:Parameter Name="Keywords" Type="String" /> <asp:Parameter Name="Copy" Type="String" /> <asp:Parameter Name="Notes" Type="String" /> <asp:Parameter Name="WriterName" Type="String" /> <asp:Parameter Name="WriterEmailAddress" Type="String" /> <asp:Parameter Name="Language" Type="String" /> </UpdateParameters> </asp:SqlDataSource> </form> </asp:Content>
View Replies !
Cannot Upload File To Database
Can anyone correct my code?I will like to add a url to my database and upload my image to web server.txtAddTitle will become my title nametxtFileName allow user to type in image name that will upload to webserver and at the meantime will insert into database as url referencesvalue for @chapterid will get from drop down list(ddlLesson) and the index value will store in database. now i am able to upload my images with the file name that i have given to web server, but I am unable to insert data to my database. Sub DoUpload(ByVal Sender As Object, ByVal e As System.EventArgs) Dim sPath As String Dim sFile As String Dim sFullPath As String Dim sSplit() As String Dim sPathFriendly As String 'Upload to same path as script. Internet Anonymous User must have write permissions sPath = Server.MapPath("../Tutorial") 'sPath = Server.MapPath(".") If Right(sPath, 1) <> "" Then sPathFriendly = sPath 'Friendly path name for display sPath = sPath & "" Else sPathFriendly = Left(sPath, Len(sPath) - 1) End If 'Save as same file name being posted 'The code below resolves the file name '(removes path info) sFile = txtFileName.Text 'sFile = txtUpload.PostedFile.FileName sSplit = Split(sFile, "") sFile = sSplit(UBound(sSplit)) sFullPath = sPath & sFile Try txtUpload.PostedFile.SaveAs(sFullPath) lblResults.Text = "<br>Upload of File " & sFile & " to " & sPathFriendly & " succeeded" Catch Ex As Exception lblResults.Text = "<br>Upload of File " & sFile & " to " & sPathFriendly & " failed for the following reason: " & Ex.Message Finally lblResults.Font.Bold = True lblResults.Visible = True End Try Dim mycommand As SqlCommand Dim myConnection As SqlConnection Message.InnerHtml = "" 'to all the valur to database If IsValid Then myConnection = New SqlConnection("Server=localhost;UID=sa;pwd=;database=u") mycommand = New SqlCommand("INSERT INTO t_linkTitle(link_chapterid,link_name,link_url) VALUES (@chapterid,@titleName,@titleUrl)", myConnection) mycommand.Parameters.Add("@chapterid", SqlDbType.VarChar, 50).Value = ddlLesson.SelectedItem.Value mycommand.Parameters.Add("@titleName", SqlDbType.VarChar, 50).Value = txtAddTitle.Text mycommand.Parameters.Add("@titleUrl", SqlDbType.VarChar, 100).Value = txtFileName.Text mycommand.Connection.Open() msgErrorTitle.Style("color") = "OrangeRed" Try mycommand.ExecuteNonQuery() msgErrorTitle.InnerHtml = "New title <b>" + txtAddTitle.Text + "</b> Added to " + "<b>" + ddlLesson.SelectedItem.Text + "</b><br>" + mycommand.ToString() Catch Exp As SqlException If Exp.Number = 2627 Then msgErrorTitle.InnerHtml = "ERROR: Title already exists. Please use another title" Else msgErrorTitle.InnerHtml = "ERROR: Could not add record, please ensure the fields are correctly filled out" End If End Try mycommand.Connection.Close() End If LoadTitle() End Sub
View Replies !
|