Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
M

Member 12016106

@Member 12016106
About
Posts
29
Topics
10
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How should I access share folder from server
    M Member 12016106

    string username = "";
    string password = "";
    {
    System.Diagnostics.Process.Start(@"\\"folder path"\ foldername");
    }

    This is my code. How should I access to server. there is username and password for the server. Could anyone help me??

    C# sysadmin help question

  • How do I download big file of applications
    M Member 12016106

    So how should declare it to download large size file??

    C# performance help question

  • How do I download big file of applications
    M Member 12016106

    I can download small size of application but could not download big size of application. It shows out of memory. Below is my code:

    string Files = ListBox1.SelectedValue;
    byte[] fileBytes = System.IO.File.ReadAllBytes(Files);

            WebClient User = new WebClient();
            byte\[\] FileBuffer = User.DownloadData(Files);
    
            if (FileBuffer != null)
            {
                System.Web.HttpContext context = System.Web.HttpContext.Current;
                context.Response.Clear();
                context.Response.ClearHeaders();
                context.Response.ClearContent();
                context.Response.ContentType = "application/octet-stream";
                context.Response.AddHeader("content-length", FileBuffer.Length.ToString());
                context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(Files));
                context.Response.BinaryWrite(FileBuffer);
                context.ApplicationInstance.CompleteRequest();
    

    Could pls anyone help...

    C# performance help question

  • Upload pdf file in MySQL....
    M Member 12016106

    Thank You soo much for your kind explanation.. I got the answer..

    C# csharp database asp-net mysql linq

  • Upload pdf file in MySQL....
    M Member 12016106

    I have try what you mentioned above but I still have an error... this is the error:

    An exception of type 'System.InvalidOperationException' occurred in MySql.Data.dll but was not handled in user code

    Additional information: Connection must be valid and open.

    c#:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.IO;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Diagnostics;
    using System.Windows.Forms;
    using System.Data;
    using MySql.Data.MySqlClient;

    namespace wsmfgit
    {
    public partial class workinstruction : System.Web.UI.Page

    {
    
        /// <connect DB>
        protected void Page\_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this.BindGrid();
            }
        }
        private void BindGrid()
        {
            string constr = @"Data Source=192.168.8.124; Database=pmdb; User ID=client; Password=client";
            using (MySqlConnection con = new MySqlConnection(constr))
            {
                using (MySqlCommand cmd = new MySqlCommand("SELECT ID, FileName, FileView FROM work\_inst"))
                {
                    using (MySqlDataAdapter sda = new MySqlDataAdapter())
                    {
                        cmd.Connection = con;
                        sda.SelectCommand = cmd;
                        using (DataTable dt = new DataTable())
                        {
                            sda.Fill(dt);
                            workinstruc.DataSource = dt;
                            workinstruc.DataBind();
                        }
                    }
                }
            }
        }
        ///</connect>
        /// <link to home button>
        protected void imgbtn\_home\_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("default.aspx");
        }
    
        protected void btn\_upload\_Click(object sender, EventArgs e)
        {
            string constr = @"Data Source=192.168.8.124; Database=pmdb; User ID=client; Password=client";
            using (MySqlConnection con = new MySqlConnection(constr))
            {
            string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
            FileUpload1.SaveAs(@"\\\\192.168.5.10\\fbar\\TOOLS\\ProbingApps\\ProbingSystem\\workinstruction\\pdf" + filename);
            con.Open();
    
    C# csharp database asp-net mysql linq

  • Upload pdf file in MySQL....
    M Member 12016106

    this is my path

    @"\\192.168.5.10\fbar\TOOLS\ProbingApps\ProbingSystem\workinstruction\pdf"

    so how should I declare it? can you pls help me..

    C# csharp database asp-net mysql linq

  • Upload pdf file in MySQL....
    M Member 12016106

    my actual path is this :

    @"\\192.168.5.10\fbar\TOOLS\ProbingApps\ProbingSystem\workinstruction\pdf"

    C# csharp database asp-net mysql linq

  • Upload pdf file in MySQL....
    M Member 12016106

    I wanted to upload my pdf files in MySQL and view from datagrid.... I have an error...This is the error.. "

    Additional information: Could not find a part of the path 'C:\WSmfgIT\WSmfgIT\WSmfgIT\wsmfgit\wsmfgit\192.168.5.10\fbar\TOOLS\ProbingApps\ProbingSystem\workinstruction

    " asp.net:

    <asp:Button ID="btn_upload" runat="server" style="z-index: 1; left: 610px; top: 337px; position: absolute; height: 23px; width: 63px" Text="Upload" OnClick="btn_upload_Click" />
    <!---GridView----->
    <div>
    <asp:GridView ID="workinstruc" CssClass="Gridview" runat="server" AutoGenerateColumns="false" DataKeyNames="FileView" >
    <HeaderStyle BackColor="#df5015" />
    <Columns>
    <asp:BoundField DataField="ID" HeaderText="ID" />
    <asp:BoundField DataField="FileName" HeaderText="FileName" />
    <asp:TemplateField HeaderText="FileView">
    <ItemTemplate>
    <asp:LinkButton ID="lnkView" runat="server" Text="View" ></asp:LinkButton>
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    </asp:GridView>
    <!--End GridView--->

    c#:

    <pre lang="cs">using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.IO;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Diagnostics;
    using System.Windows.Forms;
    using System.Data;
    using MySql.Data.MySqlClient;

    namespace wsmfgit
    {
    public partial class workinstruction : System.Web.UI.Page

    {
    
        /// &lt;connect DB&gt;
        protected void Page\_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this.BindGrid();
            }
        }
        private void BindGrid()
        {
            string constr = @&quot;Data Source=192.168.8.124; Database=pmdb; User ID=client; Password=client&quot;;
            using (MySqlConnection con = new MySqlConnection(constr))
            {
                using (MySqlCommand cmd = new MySqlCommand(&quot;SELECT ID, FileName, FileView FROM work\_inst&quot;))
                {
                    using (MySqlDataAdapter sda = new MySqlDataAdapter())
                    {
                        cmd.Connection = con;
    
    C# csharp database asp-net mysql linq

  • Alert message script
    M Member 12016106

    Thank you for kind sharing. I wanted to display files from server to list box. I also wanted to put search button to search the files. the search button must be search from all directories or subfolders. if the file not exist in the server it must show an alert message. Now, my problem is I do not know how to show alert message in c#...Could you pls help... asp.net code:

    <asp:TextBox ID="txtbox_clotho" placeholder="Search by Mac Address" runat="server" Height="21px" style="margin-left: 45px" Width="217px" BorderColor="#333333" BorderStyle="Solid" ></asp:TextBox>
    <br />
    <asp:Button ID="btn_search" runat="server" BackColor="#006699" BorderColor="Black" BorderStyle="Groove" Font-Bold="True" Font-Size="Medium" ForeColor="White" OnClick="btn_search_Click" style="z-index: 1; left: 279px; top: 58px; position: absolute; height: 30px; width: 74px" Text="Search" />
    <br />
    <br />
    <asp:ListBox ID="lstbox_clotho" runat="server" Height="81px" style="margin-left: 47px" Width="245px" ></asp:ListBox>
    <asp:ImageButton ID="imgbtn_dwn" runat="server" ImageUrl="~/images/download.png" Height="49px" Width="50px" OnClick="imgbtn_dwn_Click" />
    <br />

    c# code:

    <pre lang="cs">using System;
    using System.IO;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Collections;

    namespace wsmfgit
    {

        /// &lt;display files in listbox from directory&gt;
    public partial class downloadsoftware : System.Web.UI.Page
    {
        protected void Page\_Load(object sender, EventArgs e)
        {
    
    
    
                DirectoryInfo info = new DirectoryInfo(@&quot;\\\\192.168.5.10\\fbar\\TOOLS\\ProbingApps\\ProbingSystem\\DesktopCopyTemp&quot;);
                FileInfo\[\] Files = info.GetFiles(&quot;\*.\*&quot;);
                foreach (FileInfo file in Files)
                {
                    ListBox1.Items.Add(file.Name);
                }
    
        }
         ///&lt;/display&gt;
        /// &lt;link to home button&
    
    C# tools help question

  • Alert message script
    M Member 12016106

    using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Collections; namespace wsmfgit { /// <display files in listbox from directory> public partial class downloadsoftware : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //Directory.CreateDirectory("C:\\DesktopCopyTemp"); DirectoryInfo info = new DirectoryInfo(@"\\192.168.5.10\fbar\TOOLS\ProbingApps\ProbingSystem\DesktopCopyTemp"); FileInfo[] Files = info.GetFiles("*.*"); foreach (FileInfo file in Files) { ListBox1.Items.Add(file.Name); } } ///</display> /// <link to home button> protected void imgbtn_home_Click(object sender, ImageClickEventArgs e) { Response.Redirect("default.aspx"); } ///</link> ///<software download button1> protected void btn_dwn_Click(object sender, EventArgs e) { string File = ListBox1.SelectedValue; Response.ContentType = ContentType; Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(File)); Response.End(); } /// </software> protected void btn_search_Click(object sender, EventArgs e) { lstbox_clotho.Items.Clear(); string search=txtbox_clotho.Text; if (txtbox_clotho.Text != "") { string[] licfiles = Directory.GetFiles(@"\\192.168.5.10\fbar\TOOLS\ProbingApps\ProbingSystem\Clotho_License", "*" + txtbox_clotho.Text + "*.lic", SearchOption.AllDirectories); foreach (string file in licfiles) { lstbox_clotho.Items.Add(new ListItem(Path.GetFileName(file), file)); } { txtbox_clotho.Text = ""; } } } protected void imgbtn_dwn_Click(object sender, ImageClickEventArgs e) { string licfiles = lstbox_clotho.SelectedValue; Response.ContentType = ContentType; Response.AppendHeader("Content-Disposition", "attachmen

    C# tools help question

  • Alert message script
    M Member 12016106

    There is no error. It is not showing any messages..

    C# tools help question

  • Alert message script
    M Member 12016106

    I wanted to give alert message when the search result is invalid.... I have a code but its not working. Could anyone help me?

    protected void btn_search_Click(object sender, EventArgs e)
    {
    lstbox_clotho.Items.Clear();
    string search=txtbox_clotho.Text;
    if (txtbox_clotho.Text != "")
    {
    string[] licfiles = Directory.GetFiles(@"\\192.168.5.10\fbar\TOOLS\ProbingApps\ProbingSystem\Clotho_License", "*" + txtbox_clotho.Text + "*.lic", SearchOption.AllDirectories);
    foreach (string file in licfiles)
    {
    lstbox_clotho.Items.Add(new ListItem(Path.GetFileName(file), file));
    }

               {
                   txtbox\_clotho.Text = "";
               }
    

    else
    {
    Response.Write("<script>alert('For this Wafer ID Report is Not Generated');</script>");
    }

           }
       }
    
    C# tools help question

  • I can download file from listbox but I want it to save in specific folder in local...
    M Member 12016106

    protected void btn_dwn_Click(object sender, EventArgs e)
    {
    string File = ListBox1.SelectedValue;

            Response.ContentType = ContentType;
            Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(File));
            Response.End();
    

    }

    Now the files are saving in local, downloads folder. I don't want it to happen. I want it to automatically save in c:\ with new folder..... This is my code...Could anyone help me..

    ASP.NET help

  • I want to download file from list box. Could anyone help?
    M Member 12016106

    Thank You. its really work..

    ASP.NET tools help question

  • I want to download file from list box. Could anyone help?
    M Member 12016106

    string[] file = null;
    int idx;
    protected void Page_Load(object sender, EventArgs e)
    {
    DirectoryInfo dinfo = new DirectoryInfo(@"\\192.168.5.10\fbar\TOOLS\ProbingApps\ProbingSystem\DesktopCopyTemp");
    FileInfo[] Files = dinfo.GetFiles("*.txt");
    foreach (FileInfo file in Files)
    {
    ListBox1.Items.Add(file.Name);
    }

    }

    this is the code which shows files directory, and it display on listbox... Now, I want to download files from list box. I'm not sure with the code. please do help me....Thank You.

    ASP.NET tools help question

  • Open files from listbox file listing in c#
    M Member 12016106

    ok. thank you

    ASP.NET csharp help question

  • Open files from listbox file listing in c#
    M Member 12016106

    I have one more question. is the files can be download to local from listbox? I have looked for it but I did not get any source code for it.

    ASP.NET csharp help question

  • Open files from listbox file listing in c#
    M Member 12016106

    ya, its worked. Thank you so much for the kind share.

    ASP.NET csharp help question

  • Open files from listbox file listing in c#
    M Member 12016106

    protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
    DirectoryInfo dinfo = new DirectoryInfo(@"C:\Users\Probing\Desktop");
    FileInfo[] Files = dinfo.GetFiles("*.txt");
    foreach (FileInfo file in Files)
    {
    ListBox1.Items.Add(file.Name);
    }

    I have the source code but its not displaying anything in the listbox.. can anyone help me why is this so?

    ASP.NET csharp help question

  • I wanted to upload Multiple Files With ListBox in ASP.NET
    M Member 12016106

    Thank you so much for your help. I got the answer. I did not declare file, that's why it shows error. now I'm done.

    ASP.NET csharp asp-net database sysadmin help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups