Declaration expected on cmd

i am trying to upload my word doc file in the database and then download by clicking on the download here button but im getting errors on cmd and br.close() ,saying br,fs and cmd are not declared.
Imports System.IO
Imports System.Data.SqlClient
Imports System.Data

Partial Class SUPREME_COURT
    Inherits System.Web.UI.Page
     Read the file and convert it to Byte Array
    Dim filePath As String = Server.MapPath("Documents/Supreme Fees.docx")
    Dim filename As String = Path.GetFileName(filePath)
    Dim fs As FileStream = New FileStream(filePath, FileMode.Open, FileAccess.Read)
    Dim br As BinaryReader = New BinaryReader(fs)
    Dim bytes As Byte() = br.ReadBytes(Convert.ToInt32(fs.Length))
    br.Close()
    fs.Close()

    'insert the file into database
    ' Dim cmd As SqlCommand = New SqlCommand(strQuery)
    





    Dim strQuery As String = "insert into Files(Name, ContentType, Data) values (@Name, @ContentType, @Data)"
    Dim cmd As SqlCommand = New SqlCommand(strQuery)

    cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = filename
    cmd.Parameters.Add("@ContentType", SqlDbType.VarChar).Value = "application/vnd.ms-excel"
    cmd.Parameters.Add("@Data", SqlDbType.Binary).Value = bytes
    Function InsertUpdateData() As Boolean
        InsertUpdateData(cmd)
    End Function

    


    Public Function InsertUpdateData(ByVal cmd As SqlCommand) As Boolean
        Dim strConnString As String = System.Configuration.
            ConfigurationManager.ConnectionStrings("JSMZConnectionString").ConnectionString()

        Dim con As New SqlConnection(strConnString)
        cmd.CommandType = CommandType.Text

        cmd.Connection = con

        Try

            con.Open()
            cmd.ExecuteNonQuery()
            Return True

        Catch ex As Exception
            Response.Write(ex.Message)
            Return False

        Finally
            con.Close()
            con.Dispose()
        End Try

    End Function



    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Budwnldbtntton1.Click
        Dim strQuery As String = "select Name, ContentType, Data from tblFiles where id=@id"
        Dim cmd As SqlCommand = New SqlCommand(strQuery)
        cmd.Parameters.Add("@id", SqlDbType.Int).Value = 1
        Dim dt As DataTable = GetData(cmd)
        If dt IsNot Nothing Then
            download(dt)

        End If
    End Sub


    Public Function GetData(ByVal cmd As SqlCommand) As DataTable
        Dim dt As New DataTable
        Dim strConnString As String = System.Configuration.ConfigurationManager.ConnectionStrings("JSMZConnectionString").ConnectionString()
        Dim con As New SqlConnection(strConnString)
        Dim sda As New SqlDataAdapter
        cmd.CommandType = CommandType.Text
        cmd.Connection = con
        Try
            con.Open()
            sda.SelectCommand = cmd
            sda.Fill(dt)
            Return dt

        Catch ex As Exception

            Response.Write(ex.Message)
            Return Nothing

        Finally

            con.Close()
            sda.Dispose()
            con.Dispose()
        End Try

    End Function

    Private Sub download(dt As DataTable)
        Throw New NotImplementedException
    End Sub

End Class
0
stargun8 (2)
5/14/2014 9:27:04 AM
mozilla.dev.super-review 29307 articles. 3 followers. Post Follow

0 Replies
1495 Views

Similar Articles

[PageSpeed] 33
Get it on Google Play
Get it on Apple App Store

Reply:

Similar Artilces:

SUPER::SUPER ???
Suppose we have 3 windows : wa1 wa2 inherited from wa1 wa3 inherited from wa2 In wa3 windows, on event pfc_save I override this EVENT and I want to know the return value for pfc_save from wa1 !!! What I mean is ... how can I fire the pfc_save event for wa1 and KNOW the return value of this EVENT ? CALL only fires the EVENT, but id does not return any value of it ! Thanks Hi Stefan, if you are using CALL you can use AncestorReturnValue variable (as far I as I remember it's available since PB6) in order to get the value from your ancestor object. CALL wa1::Event...

Declaration expected??
There is something wrong...duh Can some one show me the problem... Flintar <error> Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30188: Declaration expected. Source Error: Line 12: 'creat a new Table and colums Line 13: dim dTable as new DataTable("User") Line 14: dTable.Columns.Add("FirstName", System.Type.GetType("System...

Declaration expected
I am having a little trouble getting a connection to a database going. The error I get is: Compiler Error Message: BC30188: Declaration expected. Here is the line it doesn't like: ConnectString = "Provider=SQLOLEDB; UID=username; PWD=password; Data Source=servername; Initial Catalog=databasename;" Before this line I have: Dim ConnectString As String I am not sure what the problem is, everthing looks ok to me. Thanks in advance for any help you can give me. Kevin try this Dim strConn as String = "server=localhost;database=test;UID=username; PWD=p...

Landing bug 20640 without a full review/super-review
To superreviewers, As some of you may know, I have been working on a major rewrite of the system that packages files for the installers, in order to make the packaging manifests cross-platform and configurable. This work is now complete, but I have been unable to get a full review of all my changes because they are so pervasive (there are many thousands of lines that have been moved from the central packaging manifests to locations throughout the tree). I have been coordinating my efforts with various people to make sure that the build automation process, tinderboxen, and ot...

Declaration expected
Could someone please help me debug this: Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30188: Declaration expected. Source Error: Line 308: </HEAD> Line 309: <body onload="onloadProcessing();" MS_POSITIONING="FlowLayout"> Line 310: <form id="Form1" onsubmit="return checkdates();" method="post" runat="ser...

Declaration Expected
Hi,  I am writing the following WebForma and I am getting a declaration expected error.  It seems as if the form is not recognizing using  as a reserved word.  Any thoughts? using System; using System.Drawing; using System.IO; using System.Web; using BREWServer.MapPointService; using System.Collections.Specialized; Public Class WebForm1 Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub 'NOTE: The ...

Relevance of Super-Review (Was: Hardening the review requirements for changing .webidl files)
--001a11c3735a63ae6504f7d17d7b Content-Type: text/plain; charset=UTF-8 (I want to avoid entangling the dom/webidl plan with this discussion, which is why I forked the thread) On Thu, Apr 24, 2014 at 3:22 PM, Ehsan Akhgari <ehsan.akhgari@gmail.com>wrote: > Following up on this, people asked us to not abuse the superreview flag for > this purpose If this is "abuse", doesn't that demonstrate that the super-review policy is pretty much irrelevant to the modern world, and should be changed or removed? This rule seems like a textbook use for the sr? fl...

Request for reviewers and super-reviewers to require more in-code documentation of new code
We've been adding a lot of new code lately, particularly as part of B2G. But we have not been adding high-level in-source documentation along with that code. The result is that it's becoming increasingly difficult to find one's way around our code. To be clear, my beef here isn't so much with a paucity of nitty-gritty comments in implementations about why we do something a particular way, but with the lack of higher-level comments in headers, IDL files, and JS services explaining what a class or interface is used for, how it interacts with other classes, and non-o...

Relevance of Super-Review (Was: Hardening the review requirements for changing .webidl files)
(I want to avoid entangling the dom/webidl plan with this discussion, which is why I forked the thread) On Thu, Apr 24, 2014 at 3:22 PM, Ehsan Akhgari <ehsan.akhgari@gmail.com>wrote: > Following up on this, people asked us to not abuse the superreview flag for > this purpose If this is "abuse", doesn't that demonstrate that the super-review policy is pretty much irrelevant to the modern world, and should be changed or removed? This rule seems like a textbook use for the sr? flag, aside from the fact that the reviewers must be DOM peers and not peopl...

YaST says installation media not there expecting /dev/sda1 but it is on /dev/sdb1 ... then crashes
I run Yast to install new software... A dialog box pops up and informs me that the installation media cannot be found. I check the little box for more details, and there it says it is looking for /dev/sda1. The media is at /dev/sdb1. I correct it in the little form there, but the dialog box comes up again each time it goes to the disk. It does appear to install the data, BUT THEN, before running the post install scripts, the window just disappears. So though I install apache, the files are there but it is not running. Though I install postgress, there files are there but it i...

Re: Relevance of Super-Review (Was: Hardening the review requirements for changing .webidl files)
(moving dev-b2g to bcc because cross-group threads are evil) We do have fairly clear rules: http://www.mozilla.org/hacking/reviewers.html (The definitions of "Significant" and "API" are somewhat subjective, though it's impossible to come up with completely objective definitions - IIRC there were long newsgroup threads about this when this version of the policy was created. Maybe more guidelines or concrete examples as part of the policy would be useful.) I agree with you that that policy isn't being followed our enforced consistently across the project...

Declaration Expected #2
     Dim mysqlconnectionstring As String = "server = server; database=database; uid=uid; pwd=pwd;connect timeout=30;"    Dim myadoconnection As New MySqlConnection()    myadoconnection.connectionstring = mysqlconnectionstring    myadoconnection.open() Hi, i have this above code in class.vb... i'm doing a website project. i would need to do a connection to database in order for me to insert data into the database. but when i have "myadoconnection.connectionstring = mysqlconnectionstring", the wo...

Super-review, what shall we do with you?
We've had a policy requiring super-review for certain kinds of patches for a long time. It's changed a couple of times but the current policy (http://www.mozilla.org/hacking/reviewers.html) primarily requires super-review for any patch that introduces or changes an API. Basically any function in a JS file or JSM is covered here, or at least that is my reading of it. The reasoning is pretty straightforward, designing APIs well up front reduces the maintenance burden in the future and hopefully means we don't have to make changes that break add-ons. The problem is th...

Web resources about - Declaration expected on cmd - mozilla.dev.super-review

Talk:Declaration of independence - Wikipedia, the free encyclopedia
This article is within the scope of WikiProject Politics , a collaborative effort to improve the coverage of politics on Wikipedia. If you would ...

United States Declaration of Independence - Wikipedia, the free encyclopedia
"Declaration of Independence" redirects here. For the type of document generally, see Declaration of independence . For the painting, see Trumbull's ...

ISIS is taunting Anonymous with a declaration of 'war'
... with ISIS has... A propaganda account affiliated with ISIS has released another statement related to the hacking collective Anonymous’ declaration ...

Australia v New Zealand second Test: Centuries for Steve Smith, Adam Voges as declaration looms on final ...
The trickle of wickets in Perth across the first four days of the second Test has left the chance of a result resting on the instructions and ...

Missouri Governor Seeks Federal Emergency Declaration
Missouri Gov. Jay Nixon says he's asking for a federal emergency declaration in the wake of severe flooding in the St. Louis area.

A Virginia school district shut down today after parents raged about an assignment to copy the Muslim ...
... of calligraphy," but the text, in Arabic, was "There is no God but God, and Muhammad is the messenger of God" — the shehada (or declaration ...

Ultra-Orthodox declaration on homosexuality disappears
Jewish newspaper Haaretz has noted that an ultra-orthodox statement on homosexuality has disappeared The Torah Declaration, the paper that outlines ...

ISIS is 'trying to taunt' Anonymous with a new statement on the hackers' declaration of 'war'
A propaganda account affiliated with ISIS has released another statement related to the hacking collective Anonymous' declaration of "war" on ...

No joint declaration at Asia defense meet amid sea tensions
Chron.com No joint declaration at Asia defense meet amid sea tensions Chron.com KUALA LUMPUR, Malaysia (AP) — Divisions within Asia over China's ...

French Politicians Sing Out War Declaration Against Enemies Who ‘Cut The Throats Of Your Sons’
French Politicians Sing Out War Declaration Against Enemies Who ‘Cut The Throats Of Your Sons’

Resources last updated: 1/15/2016 4:50:21 AM