Problems Uploading The ASp.Net 2.0 Website

May 29, 2007

Hello Members

I m an ASP.NET Doveloper

I have purchased a domain name and uploaded the website

I m having some problems in attaching the database

Actually i dont no the procedure

my websites address is www.webgrowthengine.com

pls help

Nitin

View 5 Replies


ADVERTISEMENT

Problem Of Uploading Asp.net Website On Web Server

Jul 16, 2007

i have developed a website using asp.net, c# with SQL SERVER EXPRESS EDITION 2005. The database is being used both for retreival and updation purpose.  the website is working accordingly when i m running it on my system, ie., data is getting retreived from the  database and it is also getting updated on button click. But when i m uloading my site on the httpdocs folder of web server, connectivity with database is failing miserably, ie neither getting retreived from the database nor getting updated.  The error message displayed by the web server is given underneath. i have used Grid view for displaying data from the database and Details view for updating the database.
i have used window authentication for connecting with the database.Please help me with finding out a solution for it. give me proper explanation and i need to do
Server Error in '/' Application.


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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
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: 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

View 10 Replies View Related

Uploading Data

Sep 22, 2006

Hi There are so many records to upload into sql server DB.we have to use scripts for this?I don't know about script.How it will be usefull and how to implement ?please help me.Thanksswapprose.

View 1 Replies View Related

Uploading An Sql Database

Oct 3, 2006

hi,my sql database works fine from my desktophowever when uploading it to my web server it does not work.i considered this could be the connection path to the database.in visual web developer i attempted to modify the connection for the actual web address on the server pc like this:C:Inetpubvhostsarcvillage.comhttpdocsApp_Datavillagers.mdf this is the actual path on the server.However visual web developer will not allow this because it says that this connection is not available ON MY PC.... so i cant save this new connection in order to upload it.any suggestions please.... or am i barking up the wrong tree!

View 8 Replies View Related

Uploading CSV/XLS File

Nov 26, 2007

I want to upload csv/xls file with more than 65000 of records.But i get an error after sometime 'Timeout Expired' while uploading into database.can anyone help me how to solve this problem.its very urgent.

View 1 Replies View Related

Uploading SQL Tables

Dec 26, 2007

In my web application I am using tables with more than 100 fields. I build such tables in my PC by means of Server Explorer. If I am not wrong such tables reside in the App_Data folder. When I upload my application to my Web Host  I would like not to build hem again. Is there any procedure  to easily reuse the already built tables and to maintain them? My Web Host provides unusable instruments to rebuild long tables. To connect to them a new Connection String is required.

View 1 Replies View Related

Regarding Uploading A Database

Jan 22, 2008

i need to upload a database(mssql2000) into a remote server.i usually generate script of the source database and run that script in the sqlanalyser in the server and generate all the tables,sp,views, etc. but not diagram.
but currently i am using a diagram with relationship set between different tables in my local machine, i don't know how to upload this diagram to the remote server, if know any method pls reply.......
 
 
 
 

View 1 Replies View Related

Uploading Images To SQL DB

Nov 17, 2005

Hi,I really appreciate any help from somebody that could help me on how I can upload images in a GridView or DetailsView using ASP.NET 2.0 - VB.NETI have looked on the internet, but could not find any example....Here are my pages :ASPX-Page :
<asp:SqlDataSource ID="SqlDataSource2"
runat="server" ConnectionString="<%$ ConnectionStrings:IMMOASPNETDBConnectionString %>"
DeleteCommand="DELETE FROM aspnet_BuyGroundImages WHERE (BuyGroundID = @Original_BuyGroundID)"
InsertCommand="AddImage" SelectCommand="SELECT BuyGroundID, BuyGroundDescription, Image1, Image2, Image3, Image4, Image5, OptionOn, Sold, Price FROM aspnet_BuyGroundImages" UpdateCommand="UPDATE aspnet_BuyGroundImages SET BuyGroundDescription = @BuyGroundDescription, Image1 = @Image1, Image2 = @Image2, Image3 = @Image3, Image4 = @Image4, Image5 = @Image5, OptionOn = @OptionOn, Sold = @Sold, Price = @Price WHERE (BuyGroundID = @original_BuyGroundID)" InsertCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="Original_BuyGroundID" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="BuyGroundDescription" />
<asp:Parameter Name="Image1" Type="Byte" />
<asp:Parameter Name="Image2" Type="Byte" />
<asp:Parameter Name="Image3" Type="Byte" />
<asp:Parameter Name="Image4" Type="Byte" />
<asp:Parameter Name="Image5" Type="Byte" />
<asp:Parameter Name="OptionOn" />
<asp:Parameter Name="Sold" />
<asp:Parameter Name="Price" />
<asp:Parameter Name="original_BuyGroundID" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="BuyGroundID" Type="Int32" />
<asp:Parameter Name="BuyGroundDescription" />
<asp:Parameter Name="Image1" />
<asp:Parameter Name="Image2" />
<asp:Parameter Name="Image3" />
<asp:Parameter Name="Image4" />
<asp:Parameter Name="Image5" />
<asp:Parameter Name="OptionOn" />
<asp:Parameter Name="Sold" />
<asp:Parameter Name="Price" />
<asp:Parameter Name="LastUpdated" Type="DateTime" />
</InsertParameters>

</asp:SqlDataSource>
<asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" AutoGenerateRows="False"
DataKeyNames="BuyGroundID" DataSourceID="SqlDataSource2" Height="50px" Width="125px" BackColor="White" BorderColor="#336666" BorderStyle="Double" BorderWidth="3px" CellPadding="4" GridLines="Horizontal">
<Fields>
<asp:BoundField DataField="BuyGroundID" HeaderText="BuyGroundID" InsertVisible="False"
ReadOnly="True" SortExpression="BuyGroundID" />
<asp:BoundField DataField="BuyGroundDescription" HeaderText="BuyGroundDescription"
SortExpression="BuyGroundDescription" />
<asp:TemplateField HeaderText="Image1" SortExpression="Image1">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Image1") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" />
<!-- <input id="File1" type="file" language="javascript" runat="server" />
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Image1") %>'></asp:TextBox> -->
</EditItemTemplate>
<InsertItemTemplate>
<input id="File2" type="file" language="javascript" runat="server" />
<!-- <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Image1") %>'></asp:TextBox> -->
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Image2" SortExpression="Image2">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Image2") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<input id="File3" type="file" language="javascript" runat="server" />
<!-- <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Image2") %>'></asp:TextBox> -->
</EditItemTemplate>
<InsertItemTemplate>
<input id="File4" type="file" language="javascript" runat="server" />
<!-- <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Image2") %>'></asp:TextBox> -->
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Image3" SortExpression="Image3">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("Image3") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<input id="File5" type="file" language="javascript" runat="server" />
<!-- <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Image3") %>'></asp:TextBox> -->
</EditItemTemplate>
<InsertItemTemplate>
<input id="File6" type="file" language="javascript" runat="server" />
<!-- <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("Image3") %>'></asp:TextBox> -->
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Image4" SortExpression="Image4">
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("Image4") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<input id="File7" type="file" language="javascript" runat="server" />
<!-- <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("Image4") %>'></asp:TextBox> -->
</EditItemTemplate>
<InsertItemTemplate>
<input id="File8" type="file" language="javascript" runat="server" />
<!-- <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("Image4") %>'></asp:TextBox> -->
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Image5" SortExpression="Image5">
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%# Bind("Image5") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<input id="File9" type="file" language="javascript" runat="server" />
<!-- <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("Image5") %>'></asp:TextBox> -->
</EditItemTemplate>
<InsertItemTemplate>
<input id="File10" type="file" language="javascript" runat="server" />
<!-- <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("Image5") %>'></asp:TextBox> -->
</InsertItemTemplate>
</asp:TemplateField>
<asp:CheckBoxField DataField="OptionOn" HeaderText="OptionOn" SortExpression="OptionOn" />
<asp:CheckBoxField DataField="Sold" HeaderText="Sold" SortExpression="Sold" />
<asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" ButtonType="Button" />
</Fields>
<FooterStyle BackColor="White" ForeColor="#333333" />
<EditRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="White" ForeColor="#333333" />
<PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
</asp:DetailsView>Code behind page:
Imports System.IO
Imports System.Data
Imports System.Data.SqlClient
Partial Class gronden
Inherits System.Web.UI.Page
Protected Sub DetailsView1_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdateEventArgs) Handles DetailsView1.ItemUpdating
Try
'copy file data into record?
Dim upload As FileUpload = CType(Me.DetailsView1.FindControl("FileUpload1"), FileUpload)
If Not upload Is Nothing Then
If upload.PostedFile.FileName <> "" Then
'copy file to a byte array in memory
Dim data(upload.PostedFile.ContentLength) As Byte
upload.PostedFile.InputStream.Read(data, 0, upload.PostedFile.ContentLength)
'get filename part only
Dim filename As String
Dim tmp As Integer = upload.PostedFile.FileName.LastIndexOf("")
If tmp >= 0 Then
'strip directory part
filename = upload.PostedFile.FileName.Substring(tmp + 1, _
upload.PostedFile.FileName.Length - tmp - 1)
Else
filename = upload.PostedFile.FileName
End If
'save this to the fields
e.NewValues("Image1") = data
e.NewValues("FileName") = filename
e.NewValues("Contenttype") = upload.PostedFile.ContentType
End If
End If
Catch Ex As Exception
Response.Write(Ex.StackTrace)
End Try
End Sub
 
End Class

View 1 Replies View Related

Uploading A File Into The Db

Feb 27, 2006

I have yet to create a query string that works and it is beginning to drive me insane. I am trying to allow a user to upload a word document into my SQL 2000 database. However I always seem to get an error when it comes time to insert the file. The table has 5 fields memnumber, papertitle, and file type are all varchar. Length is an integer and actual_file is of type image. Here is my string 
command = "INSERT INTO resumes (memnumber, papertitle, length, filetype, actual_file) VALUES ( '" & TextBox1.Text & "', '" & rightname & "', " & length & ", '" & type & "', " & filer & ")"
I can't tell you how many different versions of this string I have tried to run with none of them working, so the errors I have gotten have been varied. Most of them tell me either I can't use the & operator with file type image or that string or binary data would be truncated.

View 6 Replies View Related

Uploading Images

Apr 11, 2001

We are building an ASP application with SQL Server 2000 as a back end.

What is the best way to upload images to the server?

Thank you,
Anastasia.

View 1 Replies View Related

Uploading Data

Dec 10, 2007

Hello!!
i need to upload a csv file to sql server, i am trying to load using bcp or bulk load, but the files has null columns, so i guess, that's why the program is displaying error.

my table is as follows:

PK COLUMN TYPE SIZE NULLABLE
-----------------------------------------------
PK Object_id int 4 NO
SO varchar 4 NO
FISY smallint 2 NO
Segment_id varchar 3 NO
SubSeg_id varchar 3 NO
Line_id varchar 4 NO
Level smallint 2 NO
Type varchar 1 NO
WWB_id varchar 3 YES
SC_id varchar 6 YES
PL_id varchar 9 YES
PS_id varchar 12 YES
PSS_id varchar 18 YES
Material_id varchar 18 YES
WWCC_id varchar 2 YES


THE OBJECT ID IS THE IDENTIFIER, SO IT SHOULD UPLOAD AUTOMATICALLY

MY FILE IS SOMETHING LIKE THIS:

SO FY SEG SUBS R NIV TIPO WWB SC PL PS PSS MAT WWCC
4500 2008 100 110 R1 6 E 102 102120 102120159 102120159BBT 102120159BBT100111 300081 NULL
4500 2008 100 110 R1 6 E 102 102120 102120159 102120159BBT 102120159BBT100111 300084 NULL
4500 2008 100 110 R1 6 E 102 102705 102705453 102705453CIO 102705453CIO100282 300180 NULL
4500 2008 100 110 R1 6 E 102 102705 102705453 102705453CIQ 102705453CIQ100284 300182 NULL
4500 2008 100 110 R1 6 E 102 102705 102705453 102705453CIR 102705453CIR100285 300183 NULL
4500 2008 100 110 R1 6 E 102 102120 102120167 102120167CIF 102120167CIF100255 300256 NULL
4500 2008 100 110 R1 6 E 102 102705 102705453 102705453CJB 102705453CJB103026 300279 NULL
4500 2008 100 110 R1 6 E 102 102705 102705453 102705453CIP 102705453CIP100283 300726 NULL
4500 2008 100 110 R1 6 E 102 102120 102120167 102120167BED 102120167BED100249 300922 NULL
4500 2008 100 110 R1 6 E 102 102120 102120164 102120164BDM 102120164BDM103231 301189 NULL
4500 2008 100 110 R1 6 E 102 102120 102120159 102120159BBT 102120159BBT100114 301730 NULL
4500 2008 100 110 R1 6 E 102 102443 102443542 102443542DFJ 102443542DFJ102704 301731 NULL
4500 2008 100 110 R1 6 E 102 102705 102705453 102705453CIP 102705453CIP100283 301882 NULL
4500 2008 100 110 R1 4 E 102 102120 102120167 102120167CII NULL NULL NULL
4500 2008 100 110 R1 6 E 102 102120 102120159 102120159BBT 102120159BBT100111 302346 NULL
4500 2008 100 110 R1 6 E 102 102120 102120159 102120159BBT 102120159BBT100111 302347 NULL
4500 2008 100 110 R1 6 E 102 102120 102120159 102120159BBT 102120159BBT100111 302349 NULL


the first colums(identifier/object id) doesnt appear in the file, since it is supposed to be set automatically.
the last column is a null value.

Do you have any ideas??
why is it displayiing me an error?
which is the easiest way to upload the file??

thanx in advance

View 1 Replies View Related

Uploading Image To Database

Nov 4, 2006

I'm trying to upload an image to a database along with some other info. I have a form to get all the info from the user that I want to put in the database. Everything's getting into the database except for the actual image data. When I do a "select * from table" query on the database, the Image field reads "err", however I have an imagetype field in the db and it reads "image/jpeg". I have the following code to get the image into the database:

View 2 Replies View Related

Uploading APP_Data Folder

Apr 27, 2007

Greetings, Salutations, and Howdy
I'm using VWD on the local box and WS 2003/SQL Express on the remote box.
The first time I upload the site, the upload works great. Later after uploading updates, new pages, etc. the upload still works great.
BUT.....when I try to upload anything in the App_Data folder, I get a copy error, access denied.
On a pre-existing site with App_Data ....How do you upload the App_Data folder or it's contents to the remote server?
Thanks^2

View 6 Replies View Related

Uploading Images To Sql Server

Aug 22, 2003

Hope someone can help with this.

i am trying to upload images from an asp.net or vb.net front end to a sql server db.
I can upload the image fine if I first save the image to a file and then upload but my question is whether I can upload the image without first saving the image file. What i would like to do is to capture an image with a digital camera and without saving it first (an extra step for the user), upload it to a sql server db.

Is this even possible.

Thank you,

Biirir

View 2 Replies View Related

Uploading Files To SQL Database

Mar 19, 2006

I was following an example from the book "ASP.net unleashed" in Chapter 14, where it describes how to upload a file directly into the database.
I got it to insert the file into my database as described, and with changes created a master and detail form to select the file and display it.. (which I assume had worked).
Except, when attempting to access the file it gives two different errors. For a ppt file it gives:


The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.


An invalid character was found in text content. Error processing resource 'http://localhost:3870/SeminarOrganiser/view_file...


and for a simple txt file:


The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.


Invalid at the top level of the document. Error processing resource 'http://localhost:3870/SeminarOrganiser/view_file.aspx?...SELECT suggestEvent.suggestID, suggestEvent.uID, users.uFirstName, users.uLastName, users.uEmail, suggestEvent.suggestTitle,...From these two errors, I cannot really make sense of what has gone wrong or even why XML has even been mentioned. Looking around on the net has not allowed me any further progress.In any case, would anyone be able to explain to me what might have gone wrong?Alternatively, any links that may help would be greatly appreciated.Thank you very much in advance.

View 1 Replies View Related

Uploading Multiple Images Into SQL

May 2, 2006

Hello,
I have 3000 images to upload in SQL. I have a page that does it in ASP.net 2.0 1 by 1 but i am looking for a faster way. The targeted table look like this
*ID (int)  ImgSize  (int)  ImgContentType  (nvarchar 50)  ImgFile  (image)
Thanks for the help.

View 1 Replies View Related

Uploading Data To Different Server

Dec 2, 1999

Iam currently loading the data using dts by way of exporting the tables in textfile and then importing it at the destination. But this takes hours to do that. So i would like know best way for a big database.

View 3 Replies View Related

Uploading Reporting Services

Oct 26, 2004

Hi, may i noe how to upload the report servicing such dat i could view throu local host? TIA

View 4 Replies View Related

DTS Help With Uploading An Excel Spreadsheet

Apr 4, 2007

Can somebody please tell me what I am doing wrong or need to do to resolve my issue. I having problems with one of the columns in an excel spreadsheet that I am trying to upload into the system. One of the columns contain values of both text and numbers such as 'ABC123', 'ABC124', '123456' etc. When I try uploading the sheet into SQL Server 2000 using DTS, the system removes all characters from the one column that I am having problems with. So entry 'ABC123' for example would be truncated to '123'. I tried formatting the column that I am having trouble with in excel to 'General' format as well as tried to transform the column to type varchar in SQL Server while using the DTS wizard but still had no luck. The problem is that SQL server thinks that the column is a float type column from the source and therefore truncates any characters.

View 2 Replies View Related

Bulk Uploading RDL Files

Apr 6, 2007

Scenario: I have 80 RDL files which will be delivered to a customer to upload into their SSRS database.

Issue: Is it possible to bulk upload RDL files into SSRS instad of loading each file individually ?

If anyone has found any information on this and can direct me to it, I would be very grateful.


Thanks.

View 1 Replies View Related

SQL Server Express Uploading

Feb 24, 2008

Hi All,

I have created my first database in SQL Server 2005 Express and would like to try putting it online.

I asked the web host to create an account. They gave me host name, database name, username and password.

The problem is that i dont know where i enter that information.

I cant find the answer in my books or online. The host said i needed MSSQL Enterprise manager.

Can i get this with the Express or do i need to pay for a different version of SQL Server? If Express has it, where do i find it please?

Any help much appreciated, as i'm completely lost!

Kind regards,

Justin

View 2 Replies View Related

Uploading Image Files

May 25, 2007

I have a directory of files that I would like to upload with some datato a table so that I can store the files in the db. I'm not trying toparse files into rows, I want to stick the actual file in the column.Is there some kind of insert script, or bulk copy that I can use?I have about 150 docs and I would rather not go through the whole app,pick the file, upload it. etc.thx,M@

View 1 Replies View Related

Problem With Uploading Data SQL

Jul 20, 2005

Hello,I have problem:My *.txt file is like it:"12345612345678123abcdefabcdefghabc" etc.i want upload data into table (for example TEST) i want to sql read thisfile and automatically upload to table.(as job for example)but i have 3 columns and i dont know how to separate this text to 3 diffrenttext columns1 column | second column | third column-----------------------------------------123456 | 12345678 | 123abcdef | abcdefgh |abcPLEASE HELP ME, i dont know how to do it.Robert Kloma

View 3 Replies View Related

Connection String For Big Uploading Files

Oct 6, 2006

I have a webpage where I want to upload pdf files to my database (arround 2 MB). Putting them inside the database is the choice based on audit definitions the client has.The problem is that for big file uploads, I get the "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding." error.I believe the solution is expanding the connection timeout time in the SQL connection. But I don't want to do that in web.config, as a small timeout is good for every page except this one.What I was thinking about was something like, on button command:- "create new connection string"- use that connection string to upload the file using the datatables and tableadapters- turn back to the default connection string. How do I explicitly tell the system to "use THIS connection string on the next task" ?Alternatively, another way of doing is also appreciated!

View 4 Replies View Related

Uploading An Image And Saving Itz Path In Sql !!!! (plz)

Nov 1, 2006

well, i'm using vs2005 and sql server 2000.i've got this snippet for uploading an image and creating itz thumbnail and also saving the thumbnail and the original image in a folder.but i also want the path of the image and the thumbnail to be stored in sql 2000 database, instead of saving the images in sql.can some one plz provide me the way.thanx in advance.-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click' Initialize variablesDim sSavePath As StringDim sThumbExtension As StringDim intThumbWidth As IntegerDim intThumbHeight As Integer' Set constant valuessSavePath = ".Image"sThumbExtension = "_thumb"intThumbWidth = 160intThumbHeight = 120' If file field isn’t emptyIf Not fileUpEx.PostedFile Is Nothing Then' Check file size (mustn’t be 0)Dim myFile As HttpPostedFile = fileUpEx.PostedFileDim nFileLen As Integer = myFile.ContentLengthIf nFileLen = 0 ThenlblStatus.Text = "No file was uploaded."ReturnEnd If' Check file extension (It must be .JPG)If System.IO.Path.GetExtension(myFile.FileName).ToLower() = ".jpg" Then' Read file into a data streamDim myData() As Byte = New Byte(nFileLen) {}myFile.InputStream.Read(myData, 0, nFileLen)' Make sure a duplicate file doesn’t exist. If it does, keep on appending an ' incremental numeric until it is uniqueDim sFilename As String = System.IO.Path.GetFileName(myFile.FileName)Dim file_append As Integer = 0While System.IO.File.Exists(Server.MapPath(sSavePath + sFilename))file_append = file_append + 1sFilename = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) + file_append.ToString() + ".jpg"End While' Save the stream to diskDim NewFile As System.IO.FileStream = New System.IO.FileStream(Server.MapPath(sSavePath + sFilename), System.IO.FileMode.Create)NewFile.Write(myData, 0, myData.Length)NewFile.Close()' Check whether the file is really a JPEG by opening itDim myCallBack As System.Drawing.Image.GetThumbnailImageAbort = New System.Drawing.Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback)Dim myBitmap As Drawing.BitmapTrymyBitmap = New Drawing.Bitmap(Server.MapPath(sSavePath + sFilename))' If jpg file is a jpeg, create a thumbnail filename that is unique.file_append = 0Dim sThumbFile As String = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) + sThumbExtension + ".jpg"While System.IO.File.Exists(Server.MapPath(sSavePath + sThumbFile))file_append = file_append + 1sThumbFile = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) + file_append.ToString + sThumbExtension + ".jpg"End While' Save thumbnail and output it onto the webpageDim myThumbnail As System.Drawing.Image = myBitmap.GetThumbnailImage(intThumbWidth, intThumbHeight, myCallBack, IntPtr.Zero)myThumbnail.Save(Server.MapPath(sSavePath + sThumbFile))imgPicture.ImageUrl = sSavePath + sThumbFile' Displaying success informationlblStatus.Text = "Image uploaded successfully!"' Destroy objectsmyThumbnail.Dispose()myBitmap.Dispose()Catch errArgument As ArgumentExceptionSystem.IO.File.Delete(Server.MapPath(sSavePath + sFilename))End TryElselblStatus.Text = "The file must have an extension of JPG or GIF"ReturnEnd If End SubPublic Function ThumbnailCallback() As BooleanReturn FalseEnd Function

View 2 Replies View Related

Uploading Images/writing Info To DB

Feb 6, 2007

In my continuing saga with writing my little real estate application, I've got the need to upload images to a folder within the website and then capture some image information in a db.  I know there are many ways to do this, and have read lots of them.  However most answers don't fit what I'd like to do, or they're too complicated for me.  Anyway, thought I'd write it from scratch.   So, I have 2 pieces of code, 1 that uploads the image to a folder, and another piece that captures information to a db.  The first part works great.  The image file successfully gets uploaded.  Problem lies in the db insert code.  It's not capturing and writing to the db.  Here's my code, and thanks in advance for your help!
Partial Class Default2
Inherits System.Web.UI.PageProtected Sub page_load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load    If IsPostBack Then      Dim path As String = Server.MapPath("~/images/")      Dim fileOK As Boolean = False      If FileUpload1.HasFile Then           Dim fileExtension As String            fileExtension = System.IO.Path. _                GetExtension(FileUpload1.FileName).ToLower()            Dim allowedExtensions As String() = _                 {".jpg", ".jpeg", ".png", ".gif"}            For i As Integer = 0 To allowedExtensions.Length - 1                 If fileExtension = allowedExtensions(i) Then                 fileOK = True            End If       Next       If fileOK Then            Try                 FileUpload1.PostedFile.SaveAs(path & _                       FileUpload1.FileName)                 Label1.Text = "File uploaded!"            Catch ex As Exception                 Label1.Text = "File could not be uploaded."            End Try       Else            Label1.Text = "Cannot accept files of this type."        End If    End IfEnd IfEnd Sub
========================================================================= 
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
'Connect to the database and insert a new record into Products
Dim picDataSource As New SqlDataSource()picDataSource.ConnectionString = ConfigurationManager.ConnectionStrings("ConnectionString").ToString()picDataSource.InsertCommandType = SqlDataSourceCommandType.TextpicDataSource.InsertCommand = "INSERT INTO Images (url, title, imageTag, fileName, PictureID) VALUES (@url, @title, @imageTag, @fileName, @PictureID)"
picDataSource.InsertParameters.Add("url", "~/images/")picDataSource.InsertParameters.Add("title", imgTitleTxtbox.Text)picDataSource.InsertParameters.Add("imgTag", imgTagTxtBox.Text)picDataSource.InsertParameters.Add("fileName", imgFileNameTxtBox.Text)picDataSource.InsertParameters.Add("PictureID", 3)
Dim rowsAffected As Integer = 0
Try    rowsAffected = picDataSource.Insert()Catch ex As Exception    Label2.Text = "Label 2 File could not be uploaded."
Finally     picDataSource = Nothing
End Try
If rowsAffected <> 1 Then    Label3.Text = "Label 3 File could not be uploaded."
Else    Label3.Text = "File uploaded!"End If
End Sub
End Class
====================================================================
Here's the HTML for the upload page:
<h1>Upload Property Image(s)</h1>
<table border="0" cellpadding="10" cellspacing="0" style="width: 757px">
<tr><td style="width: 100px" align="right"><strong>Image Title</strong></td><td style="width: 100px"><asp:TextBox ID="imgTitleTxtbox" runat="server"></asp:TextBox></td></tr>
<tr><td style="width: 100px" align="right"><strong>Image File Name</strong></td><td style="width: 100px"><asp:TextBox ID="imgFileNameTxtBox" runat="server"></asp:TextBox></td></tr>
<tr><td style="width: 100px" align="right"><strong>Image Tag ID</strong></td><td style="width: 100px"><asp:TextBox ID="imgTagTxtBox" runat="server"></asp:TextBox></td></tr>
<tr><td style="width: 100px; height: 38px" align="right"><strong style="text-align: right">Add Image</strong></td><td style="width: 100px; height: 38px"><asp:FileUpload ID="FileUpload1" runat="server" /></td></tr>
<tr><td style="width: 100px; height: 38px"></td><td style="width: 100px; height: 38px"><asp:Button ID="Button1" runat="server" Text="Upload Image" /></td></tr>
</table>
<br />
<asp:Label ID="Label1" runat="server"></asp:Label><asp:Label ID="Label2" runat="server"></asp:Label><asp:Label ID="Label3" runat="server"></asp:Label>

View 6 Replies View Related

Problem Viewing The Site After Uploading

Apr 15, 2007

HI, I have upladed my application to my remote server but then I get an error message. I am a beginner so any help would be appreciated and if possible explain the solution to me in a simpler format. Here is the error message: Server Error in '/' Application.

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)



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:
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)

Source Error:





The source code that generated this unhandled exception can only be
shown when compiled in debug mode. To enable this, please follow one of
the below steps, then request the URL:1. Add a "Debug=true" directive at the top of the file that generated the error. Example:   <%@ Page Language="C#" Debug="true" %>or:2) Add the following section to the configuration file of your application:<configuration>    <system.web>        <compilation debug="true"/>    </system.web></configuration>
Note that this second technique will cause all files within a given
application to be compiled in debug mode. The first technique will
cause only that particular file to be compiled in debug mode.Important:
Running applications in debug mode does incur a memory/performance
overhead. You should make sure that an application has debugging
disabled before deploying into production scenario.Thanks in advance. 

View 1 Replies View Related

Explain To Noob, Database Uploading

Dec 25, 2007

hi,
From my ealier post I learned that a MDF file can be read and written to even if I did not attach the database in the SQL Sever Management Studio.
Is that behavior because of the connection string where is has 
AttachDBFilename=|DataDirectory|DNN12_24_07.mdf  ,
Is that what "attaches" the database?  This runs on SQL Express2005.
Should I change the connection string  to:
 name="SiteSqlServer"  connectionString="Server=(local);Database=ASPNET;uid=;pwd=;" providerName="System.Data.SqlClient" />
?
Is there a statment in the XML of web.config that defines |DataDirectory| of the original connection string  that points to APP_DATA where the mdf file physically resides?
Thanks in advance?
-KK
  

View 1 Replies View Related

Correct Way To Attach Database When Uploading.

Dec 26, 2007

hello,
After I FTP a ASP.NET website to a webserver,  APP_DATA directory and all,   I then use the SQL publishing wizard to create a script on the local machine and run the script on the webserver/SQL server, it builds ok.  But I get an error "another database with the same name".  Duplicate of the database in APP_DATA directory that is already attached by the connection string.  So this isn't correct.
Second attempt:  I FTP an ASP.NET website up to a server.  Then I open the SQL management studio and attach the database in the website's APP_DATA folder.  (never running a .sql script)The database attaches.  The name of the database is the complete path to the database in the APP_DATA directory by default.  The website functions.  But if I try to look at a table I get an errors.  It gets to the point the database will not even expand.  Then I start getting errors in the browser that NETWORK SERVICE can not open it's default database.  So the website fails also.  So this doesn't work either....
 So I guess my question is, should I remapped the path of |DataDirectory| before I FTP it?  To a path where the other common system databases reside,  (I don't think that would be necessary.)    Then FTP the website without the contents of the app folder(no database).  Then use the script built with the SQL Publishing wizard to build the database,  and attach the database in SQL Management Studio?  ( I'm afraid of over playing and corrupting the server).
If I attach the database to manage it and the connection string attaches the database to run it,  will I always get errors?  What am I missing here?   
Thanks jamesqua for your help so far,  I understood the blog you sent me too.  But how do I modify it so I can use SQL Management studio to manage the database?  
Once again from My Uncle Bob "Things are simply awful,  or awfully simple"
-KK

View 5 Replies View Related

Uploading Different Kinda Files Into SQL Database :((

Apr 6, 2005

Hi everyone!
 i am working on an web application database(asp.net,c# and sql server), wherein i wanna upload and retrieve different kinda files .
so guys, plz do, give me some info abt how exactly i can carry out the task and if possible give me the snippet too(hmm,, very lazy....)
thanx in advance
regards
kiran 

View 1 Replies View Related

Need Help For Uploading Data From Excel To SQL Server

Jul 11, 2005

I have searched the forum for the code and found one. But, I encounter a problem which i can't understand.Can anyone help me with this?I encounter a "Keyword not supported: Provider"But then i have try to take out the provider and the result is they ask for a provider.Help!! ' Create the connection object for the Excel file Dim excelConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" _ & "Data Source=" & filepath & ";" & "Extended Properties=Excel 8.0;") excelConn.Open() ' Get the name of the Excel spreadsheet Dim schemaTable As DataTable = excelConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, _ New Object() {Nothing, Nothing, Nothing, "TABLE"}) Dim excelSheetName As String = schemaTable.Rows(0).ItemArray(2) ' Create the connection object for the SQL Server database Dim sqlConn As New SqlConnection(strSqlConnString) sqlConn.Open() Try ' Create new OleDbDataAdapter that is used to build a DataSet Dim excelDataAdapter As New OleDbDataAdapter("SELECT * FROM [" _ & excelSheetName & "]", excelConn) Dim excelDataSet As New DataSet ' Treat newly added rows as inserted rows, so they will all ' be inserted into SQL table excelDataAdapter.AcceptChangesDuringFill = False excelDataAdapter.Fill(excelDataSet, tablename) Dim excelTable As DataTable = excelDataSet.Tables(tablename) ' Create new SqlDataAdapter that is used to build a DataSet Dim sqlDataAdapter As New SqlDataAdapter("select * from " & tablename, sqlConn) Dim sqlDataSet As New DataSet sqlDataAdapter.Fill(sqlDataSet, tablename) Dim sqlTable As DataTable = sqlDataSet.Tables(tablename) ' Loop through each column name in the Excel DataSet and make sure it matches a ' column name in the SQL Server DataSet Dim excelCol, sqlCol As DataColumn Dim allColsCorrect, matchFound As Boolean allColsCorrect = True For Each excelCol In excelTable.Columns matchFound = False For Each sqlCol In sqlTable.Columns If excelCol.ColumnName.ToLower.Equals(sqlCol.ColumnName.ToLower) Then matchFound = True Exit For End If Next sqlCol 'CloseMonth is a field in the Excel sheet, but not in SQL DB, so just ignore If matchFound = False Then If Not (excelCol.ColumnName.ToLower.Equals("CloseMonth".ToLower)) Then Response.Write("<br>**Column '" & excelCol.ColumnName & _ "' in Excel file does not exist in SQL Server table.") allColsCorrect = False End If End If Next excelCol ' If all columns in Excel table match those in SQL table, then delete current ' contents of the SQL table and insert the data from the Excel table If allColsCorrect = True Then Dim deleteCommand As New SqlCommand("TRUNCATE TABLE " & tablename, sqlConn) deleteCommand.ExecuteNonQuery() Response.Write("- Deleted old data from SQL Server table.<br>") ' Create the CommandBuilder object to create the Transact SQL (TSQL) commands ' that are necessary to update and to insert records into the data source. Dim x As SqlCommandBuilder = New SqlCommandBuilder(sqlDataAdapter) Try 'sqlDataAdapter.ContinueUpdateOnError = True sqlDataAdapter.Update(excelDataSet, tablename) Response.Write("- Updated data in SQL Server table.<br>") Catch Exc As Exception Response.Write("<br>Error(message): " & Exc.Message) End Try Else Response.Write("<br>(The spreadsheet could not be loaded into the table " & _ "because of the above errors.)<br>") End If Catch Exc As Exception Response.Write("<br>Error: " & Exc.Message) End Try ' Clean up objects. excelConn.Close() sqlConn.Close()

View 1 Replies View Related

Uploading Images Using An SQLDataSource Control

Nov 17, 2005

Hi,I would like to upload images using an SQLDataSource Control with a DetailsView, so that users can update/insert/delete records.Can someone tell me how I can do this in VB.NET ?It seems that I'm the only one on the world trying to do this already with ASP.NET VWD 2005.Thanks to all....Bart

View 1 Replies View Related

Difficulty Uploading Information To Database

Dec 1, 2005

This is probably a very simple question but i am having problems with inserting information into database
The function takes the values "FirstName" And "LastName" from  A table Called "Customer" and the value "ProductID" from a table called "Products" and inserts them into a table called " NewOrder".
Everything compiles ok but when I press the button the information is not uploaded to thedatabase. ( There is no error message)
This is the stored procedure
CREATE PROCEDURE SP_NewOrder(@CartID char (36), @CustomerID Varchar (50))AS
INSERT INTO NewOrder (FirstName, LastName, ProductID)
SELECT Customer.FirstName, Customer.LastName, Products.ProductID
From Customer,Products Join ShoppingCart ON Products.ProductID =ShoppingCart.ProductIDWHERE ShoppingCart.CartID = @CartID AND Customer.CustomerID = @CustomerIDGO
This is the Function
Public Shared Function CreateOrder() AS String   Dim customerID As integer   Dim connection as New SqlConnection(connectionString)   Dim command as New SqlCommand("SP_NewOrder",connection)   command.CommandType = CommandType.StoredProcedure   command.Parameters.Add("@CartID", SqlDbType.Char,36)   command.Parameters("@CartID").Value = shoppingCartID   command.Parameters.Add("@CustomerID", SqlDbType.Varchar,36)   command.Parameters("@CustomerID").Value = customerID  Try
  connection.Open()  command.ExecuteNonQuery()  Finally  connection.Close()
        End TryEnd Function
This is the page code
Sub btn3_Click(sender As Object, e As EventArgs)Dim cart as New ShoppingCart()Dim shoppingCartID As IntegerDim customerID As Integer = Context.Session("worldshop_CustomerID")cart.CreateOrder()End Sub
Can Anyone see where I am going wrong
Many thanks
martin

View 2 Replies View Related







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