Click here to Skip to main content
15,908,111 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Page Refresh Problem Pin
neerubee15-Jul-07 20:39
neerubee15-Jul-07 20:39 
AnswerRe: Page Refresh Problem Pin
rahul.net1115-Jul-07 20:56
rahul.net1115-Jul-07 20:56 
QuestionASP.Net with ColdFusion Pin
Quest0715-Jul-07 19:45
Quest0715-Jul-07 19:45 
QuestionAjax in vs 2003?, Pin
Member 387988115-Jul-07 19:31
Member 387988115-Jul-07 19:31 
AnswerRe: Ajax in vs 2003?, Pin
N a v a n e e t h15-Jul-07 20:11
N a v a n e e t h15-Jul-07 20:11 
GeneralRe: Ajax in vs 2003?, Pin
Member 387988115-Jul-07 20:15
Member 387988115-Jul-07 20:15 
GeneralRe: Ajax in vs 2003?, Pin
N a v a n e e t h15-Jul-07 20:22
N a v a n e e t h15-Jul-07 20:22 
QuestionUploading documents to SQL with vb.net [modified] Pin
AaronM_NZ15-Jul-07 19:18
AaronM_NZ15-Jul-07 19:18 
Ok, I have been searching for a while on this, and just cant work it out. I have web form with a INPUT type='file' called fileToAdd, and a textbox called tbTitle, and a button called btnUp.

The IDE is complaining about the line 'objStream.Read (bDocTemp, 0, iDocLength)', saying "'1-dimensional array of Byte' cannot be converted to '1-dimensional array of Char' because 'Byte' is not derived from 'Char'."

Fair enough, but I just cant figure out how to get it as a byte, all the examples I have found on the net for uploading images are the same as below, but it just wont work! If I DIM bDocTemp as a CHAR, the error goes away, but it wont work at run time.

Argghh! Any help will be appreciated please! Thanks


Protected Sub btnUp_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUp.Click
        Dim iDocLength As Integer = fileToAdd.PostedFile.ContentLength
        Dim sExt As String = fileToAdd.PostedFile.FileName.ToString()
        sExt = sExt.Substring(sExt.IndexOf(".", 0), 4)

        Dim objConn As New SqlConnection("Data Source=XXXXX;Initial Catalog=XXXX;Persist Security Info=True;User ID=XXXXX;Password=XXXXX")
        objConn.Open()

        Dim objCmd As New SqlCommand("spUploadFile", objConn)
        objCmd.CommandType = Data.CommandType.StoredProcedure

        Dim pTitle As New SqlParameter
        pTitle = objCmd.Parameters.Add("@Title", Data.SqlDbType.VarChar, 200)
        pTitle.Direction = Data.ParameterDirection.Output
        pTitle.Value = tbTitle.Text

        Dim pType As New SqlParameter
        pTitle = objCmd.Parameters.Add("@Type", Data.SqlDbType.VarChar, 3)
        pType.Value = sExt.ToString

        Dim bDocTemp(iDocLength - 1) As Byte

        Dim objStream As StreamReader = New StreamReader(fileToAdd.PostedFile.InputStream)
        objStream.Read (bDocTemp, 0, iDocLength)      '<----Error here

        Dim pDocument As New SqlParameter
        pDocument = objCmd.Parameters.Add("@Document", Data.SqlDbType.Image)
        pDocument.Value = bDocTemp

        Dim pUser As New SqlParameter
        pUser = objCmd.Parameters.Add("@user", Data.SqlDbType.VarChar, 50)
        pUser.Value = Request.ServerVariables("AUTH_USER").ToString

        objCmd.ExecuteNonQuery()
        objConn.Close()

    End Sub


-- modified at 1:26 Monday 16th July, 2007
QuestionCrystalReport1 = new CrystalReport1(); Pin
Jagadeesh Jupalli15-Jul-07 19:06
Jagadeesh Jupalli15-Jul-07 19:06 
AnswerRe: CrystalReport1 = new CrystalReport1(); Pin
Harini N K15-Jul-07 19:13
Harini N K15-Jul-07 19:13 
GeneralRe: CrystalReport1 = new CrystalReport1(); Pin
Jagadeesh Jupalli15-Jul-07 19:47
Jagadeesh Jupalli15-Jul-07 19:47 
GeneralRe: CrystalReport1 = new CrystalReport1(); Pin
Harini N K15-Jul-07 19:50
Harini N K15-Jul-07 19:50 
GeneralRe: CrystalReport1 = new CrystalReport1(); Pin
Jagadeesh Jupalli15-Jul-07 20:01
Jagadeesh Jupalli15-Jul-07 20:01 
GeneralRe: CrystalReport1 = new CrystalReport1(); Pin
Jagadeesh Jupalli15-Jul-07 20:06
Jagadeesh Jupalli15-Jul-07 20:06 
GeneralRe: CrystalReport1 = new CrystalReport1(); Pin
Jagadeesh Jupalli15-Jul-07 20:13
Jagadeesh Jupalli15-Jul-07 20:13 
GeneralRe: CrystalReport1 = new CrystalReport1(); Pin
Harini N K15-Jul-07 20:16
Harini N K15-Jul-07 20:16 
GeneralRe: CrystalReport1 = new CrystalReport1(); Pin
Jagadeesh Jupalli15-Jul-07 20:21
Jagadeesh Jupalli15-Jul-07 20:21 
GeneralRe: CrystalReport1 = new CrystalReport1(); Pin
Harini N K15-Jul-07 20:33
Harini N K15-Jul-07 20:33 
GeneralRe: CrystalReport1 = new CrystalReport1(); Pin
Jagadeesh Jupalli15-Jul-07 20:46
Jagadeesh Jupalli15-Jul-07 20:46 
GeneralRe: CrystalReport1 = new CrystalReport1(); Pin
Jagadeesh Jupalli15-Jul-07 20:51
Jagadeesh Jupalli15-Jul-07 20:51 
QuestionEXPORTING GRIDVIEW PAGING DATA TO EXCEL. IN ASP.NET Pin
Sonia Gupta15-Jul-07 19:00
Sonia Gupta15-Jul-07 19:00 
AnswerRe: EXPORTING GRIDVIEW PAGING DATA TO EXCEL. IN ASP.NET Pin
neerubee15-Jul-07 19:24
neerubee15-Jul-07 19:24 
GeneralRe: EXPORTING GRIDVIEW PAGING DATA TO EXCEL. IN ASP.NET Pin
Member 387988115-Jul-07 19:52
Member 387988115-Jul-07 19:52 
GeneralRe: EXPORTING GRIDVIEW PAGING DATA TO EXCEL. IN ASP.NET Pin
neerubee15-Jul-07 20:16
neerubee15-Jul-07 20:16 
AnswerRe: EXPORTING GRIDVIEW PAGING DATA TO EXCEL. IN ASP.NET Pin
neerubee17-Jul-07 0:29
neerubee17-Jul-07 0:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.