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.
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.
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>
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
I am having a problem with MMSQL BLOB with VB, Sorry to say I am new in Programming using VB 6 and MSSQL and I have never touch BLOB in my live.
I just wish anyone could give me any ideal, like, white pages, or manual on how do I insert BLOB data (Images) to MSSQL 2000 database using VB 6. I need to know exspecially the VB Code and the SQL Portion if you have a store procedure code for that it will be nice. :confused:
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.
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)
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()
Please bear with me because I am brand new to SQL Server, and I may not be using the correct wording to explain everything...
I`m using Access 97 to upload a table to a SQL Server 6.5 database. I also have SQL Enterprise Manager. The allocated space on the SQL Server for my database is 20 MB and the space for my database log file is 4 MB. The first time I tried to upload a table to the database, I got the following error:
[Microsoft][ODBC SQL Server Driver][SQL Server] Can`t allocate space for object "syslogs` in database `testpropcontdb` because the `logsegment` segment is full. If you ran out of space in Syslogs, dump the transaction log. Otherwise, use ALTER DATABASE or sp_extendsegment to increase the size of the segment (#1105)
I went into the Enterprise Manager and right clicked on my database and selected edit. It shows that I have 19.89 of the 20 MB free, and all 4 MB of my log space free.
When I select GET EXTERNAL DATA -> LINK TABLES from the FILE menu in Access, and link to the table I just uploaded to SQL Server, the structure (field names and attributes) is there, even though I got that error message earlier. There is just no data being uploaded.
Could someone please point me in the right direction? I`ve been reading help files and searching the net, but I haven`t figured out what is causing this error message.
Client side: 1. my DSN is CMDB.dsn on a mapped network drive(only way for now that I get a connection) 2. My client does not fail to connect, but I am having a hard time linking my database tables to each other. Through Access 03. 3. My client is remote 4. I can ping the server, 5. but I cannot telnet 6. My application is Access 2003, 7. I am on a different domain 9. I have table names that match, 10. I do not force encryption.
Server side: 1. SQL SERVER 2005 2. Standard Edition 3. TCPIP 4. The server starts fine 5. The SQL browser is enabled YES 6. Domain Account 7. Not applicable 8. NO
Platform: 1. Client runs Windows XP, Server runs Windows Server 2003
My question then is this: Does anyone know of code that can be used to import data from a CSV file to a server on a different domain? This is tricky cause the connection is not really allowing this kind of access. Which is my next question: How do you get these two applications to connect? I don't want to do it with ADP, and linking the tables I always seem to have to place the DSN on a mapped network drive to get results. Then after that I go to link tables from the SQL Server and the tables I created there are no where to be found. Why is this happening? It gives me a list of System tables but none of my
I designed a package in SSIS that loads data from an Excel source into a oledb SQL database table.
The problem I have is that two of the columns that are supposed to be nvarchar type columns sometimes contain numerical strings. These values causes an error when 'Allow Null' is not set and loads as NULL if 'Allow Null' is set.
How can I force these values into the table?
I have a script transformation object in the package with this code:
If IsNumeric(Row.OCCode) Then
Row.ItemCode = CStr(Row.OCCode)
Else
Row.ItemCode = Row.OCCode
End If
ItemCode is of type unicode string and the column in the SQL DB Table it's mapped to is of type nvarchar
Hi, I'm developing a website using VWD 2005 Express, which needs a Membership system and a products database. Using the VWD inherent Web Site Administration tool makes the membership set up easy but by default it creates a 'Local' SQL database in a folder named 'Apps_Data' in the VWD project. My question is: considering I will need to upload my web site to a Hosting Service, would it be better to change the default so that the membership systems, and the product database I need, are created in an SQL 'Server' database instead of a 'Local' database? The hosting service I am considering using is having a bit of a problem understanding this question, I hope it makes sense to someone or am I asking a stupid question? Regards Sean.
Need to change the datatype of existing column which has huge data.
I'm performing below steps
1. Create new column with correct datatype in the same table 2. copy data into new column 3. drop indexes on column 4. <<<>>> now the existing column also has many SP dependent and I do not wish to drop them. 5. rename existing column to xxx 6. rename new column to correct column 7. drop old column 8. make required indexes
I would like some help in uploading a database from my harddrive to a server using sql server management studio express.
If I try to attach it to the server, this program only looks at the files on this server and not on my harddrive. So how can I copy a sql database to my folder on the server.
I am sure it must be a simple problem, but I've been bizzy with it for about a day now. So, please advice.
I am new with Visual Web Developer SQL Express and for a start I have been using the VWDHosting.net (Trial hosting for VWD 2005 Express) with a test website using login and membership controls. I followed the excellent instruction in the User Guide (for transferring data and adapting the connectionstring) and it worked succesfully. However, I have problems getting the same test website installed with my hosting provider.The VWDhosting.net has a special functionality for uploading the contents of a local database to a database created on the server. In the Restore database section is a field the "Restore database from SQL Server 2005 mdf file". After selecting in that field your local database, you can click the "Attach"-button and then the contents of the local database are transferred to the database on the server. With my hosting provider (using SQL Server 2000) I have to use the same procedure: creating a MS SQL database on the server and then transfer the contents of my local database. How can I do this? (My hosting provider does not offer me a similar "Attach" button).Do I have to use SQL Server Management Studio?Kees
I am very frustrated. Everything works on the local host but when I upload to server I can login to the admin role I created, but when I try to access pages that have role priveleges I get the following error: The SSE Provider did not find the database file specified in the connection string. At the configured trust level (below High trust level), the SSE provider can not automatically create the database file. The ASPNETDB.MDF database was uploaded using the Database Publishing Wizard. Please help!
All right, I've got a small sample of database-driven code running nicely on my own computer using an MS SQL database with code something like this to connect to it. (passwords and user ID's changed to protect the innocent)
Now, I want it to run on a web server, but there doesn't seem to be any simple "click here to upload your database without tearing your hair out in frustration" button. Only an option to "add ODBC data source" which has the following fields: data source name(dsn): ________ ODBC Driver Name: SQL Server (this value cannot be changed) DSN Description: ________ Associated SQL Server:_________ Default Database Name:_________
Without any option to upload any database files, though if I go into file manager, I notice that there is an MSSQL folder, which I assume I should be uploading the database into. But which file(s) from my database should I upload and what should I fill the blanks above in with? Thanks in advance. Do I have to change the connection code?
I'm populating an Access continuous form with lots of icons from a SQLServer backend. If I remove the field holding the icons from thestored procedure, the form loads 5X faster. Is there any sort of trickto improve the performance of this sort of scheme?lq
I am trying to create a website that people can upload an image and have it saved to a database. Can someone point me in the right direction on this? What properties need to be saved in the db and how?
Hello, I am trying to put on a webpage a picture with a discription, however when I create an MxDataGrid and run the page all the info in the datagrid is correct except the image. All that is in the field is "System.Byte[]". I am new to web programming but I have created many databases and using Access as a front end where this process is very straightforward. Can anyone tell me how I can make this work? I want to store images along with other info about the image in the database so that I can simply query the database and have the page fill from the query. Thanks whill1
Hi Guru's,I want to show images in my webforms, but whitout any succes....... , hope some can tell me why as base I've used exactly the same script as defined in the article http://www.dotnetbips.com/displayarticle.aspx?id=101 Maybe its because some of the HTML is incorrect ?<itemtemplate> <asp:image id="img" runat= server></asp:image></itemtemplate>Please , a need some assitance hereregardsS
I wanted to store image files in my Db.So can i use image data type?If i can use the image data type how big images can i store.My image are arounf 10 mb in size. Thanks.
I have a problem and I do not know what way to go:
We have a large amount of images that we need to store (large amount is more that 1.000.000), the logical question is, whether we shall store them in the database, or we should store them separate on the file-system, and place the filepath and filename in the database.
Some articles say that SQL Server 2000 will get performance problems with this amount of images stored in the database, others say that it should be no problem.
Can someone please give me a advice?
Best regards,
Mischa E.J. Hoogendoorn Delphi Programmer SQL Server 2000 DBA