|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
uploading file to sql server
I got some problem in uploading file into the sql server used ASP.
There is no error occur but the file can't be upload into the database. This is the connection to the sql server: function GetConnection() dim Conn Conn.Provider = "SQLOLEDB" Conn.Open "Server=(Local);Database=userinfo", "sa", "sa" set GetConnection = Conn end function function CreateUploadTable(Conn) dim SQL SQL = SQL & "CREATE TABLE Upload (" SQL = SQL & " UploadID int IDENTITY (1, 1) NOT NULL ," SQL = SQL & " UploadDT datetime NULL ," SQL = SQL & " RemoteIP char (15) NULL ," SQL = SQL & " ContentType char (64) NULL ," SQL = SQL & " SouceFileName varchar (255) NULL ," SQL = SQL & " Title varchar (255) NULL ," SQL = SQL & " Description text NULL ," SQL = SQL & " Data image NULL " SQL = SQL & ")" Conn.Execute SQL end function function DBSaveUpload(Fields) dim Conn, RS Set Conn = GetConnection Set RS = Server.CreateObject("ADODB.Recordset") RS.Open "Upload", Conn, 2, 2 RS.AddNew RS("UploadDT") = Now() RS("RemoteIP") = Request.ServerVariables("REMOTE_ADDR") RS("ContentType") = Fields("DBFile").ContentType RS("SouceFileName") = Fields("DBFile").FileName RS("DataSize") = Fields("DBFile").Value.Length RS("Description") = Fields("Description").Value.String RS("Title") = Fields("Title").Value.String if IncludeType=1 then'For ScriptUtilities RS("Data").AppendChunk Fields("DBFile").Value.ByteArray Else'For PureASP upload - String is implemented as method. RS("Data").AppendChunk MultiByteToBinary(Fields("DBFile").Value.ByteArray) End If RS.Update RS.Close Conn.Close DBSaveUpload = "Upload has been successfull" end function Pls help me! |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > uploading file to sql server |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|