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


ADVERTISEMENT

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 SQL SERVER With Remote Data.

Jan 3, 2007

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

View 1 Replies View Related

Problem Uploading Data Into SQL Server With SSIS

May 24, 2007

Hi



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

View 10 Replies View Related

SQL Server 2012 :: New Column In Existing Table And Uploading Data

Jan 13, 2015

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

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

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

Uploading Data From A Different Type Of Database

Dec 22, 2006

How do I upload test data from a frame maker database to SQL database tables using ODBC.

View 6 Replies View Related

Problem In Data Flow While Uploading

Dec 14, 2007

[Source - Samp_txt [1]] Error: Data conversion failed. The data conversion for column "Column 2" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.".

The column width for column2 is 60 and i have cross checked several times that i have created the column width as 60 in SQL Server table for the corresponding field.

Sarvan

View 4 Replies View Related

Problem During Uploading Data Through RDA Object.

Mar 3, 2008

Hello Friends

During downloading tabel from remote server, I am using follwing code with traking option ON as follows

RDASpotLighter.Pull("TableName" , SelectFromServer ,RemoteConnString,RdaTrackOption.TrackingOn,"ErrorTableName");

And during uploading same table with data, I am using RDA object as follows

RDASpotLighter.Push(TableName, RemoteConnString, RdaBatchOption.BatchingOff);

When I tried to upload uploaded data, RDA throws an exception and removed that data row from main table and insert into Error table. But this behavior is inconsistence like some time I got that exception but some times I don€™t.

Actually the problem is, some times RDA does updating data on server where I excepting insertion should be perform. I eager to know about when RDA does perform INSERT operation AND when does perform UPDATE operation on server data.

Please help to figure out this problem.
Anil

View 1 Replies View Related

Data Source Type Not Overwritten When Uploading RDL

Nov 5, 2007



Hello,


I've been working on an application that uploads an RDL to Reporting Services programmatically. I'm having problem with the data source properties for my uploaded report. The datasource for my report is custom datasource. It work s fine if the report still did not exist. But if the report already exist, after I upload the report to Reporting Services, the function will overwrite the RDL but it did not overwrite the Data source type correctly. Other setting like connection string is overwritten correctly.

For example, I already have RDL ABC with Data source type SQL, when I try to overwrite the existing RDL ABC which have Data source type Assembly, it still hold the SQL value for the data source type. But in the RDL itself (I checked in the rdl script in <DataProvider> tag), the value already overwritten to Assembly.

This problem also happen when I try to upload RDL using Report Manager. The Data source type are not overwritten by the action.

What should I do? Why it did not overwrite the datasource type? Maybe I do anything wrong here. I dont know what. Hope someone can help.


Thanks in advance

View 1 Replies View Related

Fast Uploading Data From Client To SQL2000 Database

Mar 4, 2005

Does anyone know how to upload (bulk) data from a client (written in Excel VBA) to a remote SQL2000 database? Of coarse I tried "INSERT INTO" and rst.addnew but I noticed this is much, much slower as downloading from the same remote database.

Thanks.

View 3 Replies View Related

Uploading Text And Numeric Data From An Excel File

Nov 3, 2006

Hi,

I have found a problem with my SSIS package. The package takes a Excel File using the Excel Source/Excel connection manager objects. There's a Data Conversion Object which sets all the fields to be DT_STR and then I import the data into a Holding table using a OLEDB Destination Object.

My Excel file contains a list of Code/Description pairs. The problem I have is that I can have data such as the following

CODE

A101

A102

A103

12

1.2i



What seems to be happening is that when the data is imported into the holding table and the first rows are Alphanumeric then the fields where there's a code such as 12 get converted to NULL for some reason. If all the codes are the same type (either Alphanumeric or numericit doesn't matter, as long as they are all the same) the import works perfectly well.



I need to be able to import all of these codes without SSIS converting some to NULL. Has anyone come across this problem before? If so, is there something I am doing wrong or a workaround?



Many thanks in advance

Rob

View 3 Replies View Related

Errors When Uploading DDL And Data File Created By Database Publishing Wizard

Jul 17, 2007

Hi,



I needed to recreate/publish a DDL and data file(of a database) that was produced using Database Publishing Wizard. The size of the file is 4G. I receive the following error when I try to open it up in the new query window of sql server 2005 (sp2)for execution.



"The operation could not be completed. Not enough storage is available to complete this operation."



I know my server has 829G of free storage space available. i receive no errors when I open up a smaller file also created by database publishing wizard.



What possibly is causing this?



Thanks in advance

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

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

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 Access 97 Table To SQL Server

Oct 16, 1998

Hi all,

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.

Thanks in advance for lending your expertise.

Elizabeth Fisher

View 3 Replies View Related

Uploading Video Clip In Sql Server 2005?

Feb 22, 2007

Hi All,
How can I upload Video Clip in Sql Server 2005?
 
Regards,

View 1 Replies View Related

SQL 'Server' Or 'Local' Database For Uploading To Hosting Service Provider

Mar 23, 2007

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.

View 2 Replies View Related

Uploading Database To Sever With Sql Server Management Studio Express

Jun 28, 2007

Hello,



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.



Rgds,



Wouter.

View 7 Replies View Related

Uploading An SQL Server Express Database To A Server

Oct 8, 2006

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

View 1 Replies View Related

Uploading Tables On Sql Server (domain Server)

Mar 11, 2000

Hi everybody,

Please suggest me a guideline to upload tables on sql server
for internet based application.

Actually I want to know the exact procedure what are the files to
upload (of sql server) OR i have to export the whole database
to the domain server.

Thank you
Harish

View 1 Replies View Related

Uploading SQL Express To SQL Server 2005 - Role's Causes Application Error With SSE Provider

Jun 25, 2007

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!

View 1 Replies View Related

Uploading SQL Server Database To A Server?

Mar 4, 2005

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)


connect_String = _
"Data Source = mysource;User ID=joeblow;Password=monkey;database=Reservation"
db_conn = New SqlConnection(connect_String)


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?

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







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