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
N

nassimnastaran

@nassimnastaran
About
Posts
73
Topics
28
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • DaraReader problem ...
    N nassimnastaran

    Yes , thanks , I use If and else when dbIsNull . It works .

    C# help

  • DaraReader problem ...
    N nassimnastaran

    I want To do This :

    BuyAmount.Text = "0";

    When there is No Row in dataReader thanks

    C# help

  • DaraReader problem ...
    N nassimnastaran

    Hi ALL ! I want to execute this by OledbDataReader when I want to take ... :

    string CalcQuery = @"SELECT SUM(BuyAmount) From SubTblMetal WHERE IDMetal=" + int.Parse(txtId.ToString());
    OleDbCommand cmdCacl;
    cnnCalc.Open();
    cmdCacl = new OleDbCommand(CalcQuery, cnnCalc);
    OleDbDataReader dr;
    dr = cmdCacl.ExecuteReader();
    if (dr.HasRows==false)
    {
    txtBuyAmount.Text = "0";
    throw new Exception();
    }
    else if (dr.Read())
    {
    txtBuyAmount.Text = dr[0].ToString();

                }
    

    But when my DataReader has not any row ,I have an error for the value of txtBuAmount.Text please Help , how can get the value of Zero (0) , when dataRow has not any row(value). Thanks a lot !

    C# help

  • Save in related table ...
    N nassimnastaran

    Yes , but I want that the User have an option to Fill datagrid(subTable) or not , so it can be Blank ... thanks

    C# announcement

  • Save in related table ...
    N nassimnastaran

    Hi there ! I have two table (mainTable & SubTable) with these fileds : mainTable --> IdMetal , NameMetal , Formula , ... SubTable --> IDDetails,IdMetal , Company , ... also mainTable.IdMetal=SubTable.IdMetal in myForm , I have some TextBox that filled by MainTable Fields and Datagrid that filled by subTable Fields when I want to create New row(Save) in main table , at the same time i want to fill and save in datagrid , here is my code :

    try
    {
    // for MainTable ...
    OleDbConnection cnnSave=new OleDbConnection(myConnection);
    OleDbCommand cmd__AddRows = new OleDbCommand();
    cmd__AddRows.CommandText =
    @"INSERT INTO MainRegTable (IDMetal,NameMetal,FormulMetal, GroupMetal, CodeMetal,Comments)
    VALUES (@p1,@p2,@p3,@p4,@p5,@p6)";
    cmd__AddRows.Parameters.Clear();
    cmd__AddRows.Parameters.AddWithValue("@p1", txtID.Text);
    ....
    //for subTable ...
    OleDbDataAdapter dagrd = new OleDbDataAdapter(@"Select * From SubTblMetal
    WHERE IDMetal=
    "+int.Parse(txtID.Text),
    cnnSave);
    DataSet dsGrd = new DataSet();
    dagrd.Fill(dsGrd, "SubTblMetal");
    dsGrd.GetChanges();
    dagrd.Update(dsGrd);
    dsGrd.AcceptChanges();

    but , no changes in subtable ... thanks for Reply

    power is knowledge ...

    C# announcement

  • How to refresh or update DataGrid Cell Value ...
    N nassimnastaran

    thanks , it solve the problem ! ;)

    C# com help tutorial announcement

  • How to refresh or update DataGrid Cell Value ...
    N nassimnastaran

    Hi all ! I want to save the DataGrid Cell Value into an excel file :

    ...
    try
    {
    mySheetInputData = (Microsoft.Office.Interop.Excel.Worksheet)ExWorkBookInputData.Sheets["Sheet1"];

    mySheetInputData = (Microsoft.Office.Interop.Excel.Worksheet)ExWorkBookInputData.ActiveSheet;

    mySheetInputData.Name = "mySheet";
    ...
    for (int i = 0; i < RowCount; i++)
    {
    for (int j = 0; j < ColumnCount; j++)
    {
    mySheet.Cells[i + 2, j + 2] = dgv.Rows[i].Cells[j].Value;
    if (dgv.Rows[i].Cells[j].Value == null || dgvRows[i].Cells[j].Value.Equals(""))
    mySheet.Cells[i + 2, j + 2] = 0.0;
    }
    }

    dgv.update();

    ....

    when I save this to an excel file , last cell i fill , show the value of "0.0" , but when I resize or minimize the application or change the cursor in the next cell that fill before , there is no problem to show all value i put to DataGrid Cell. thanks a lot !

    C# com help tutorial announcement

  • How to open File using System.Diagnostics.Start in the Base Root directory
    N nassimnastaran

    thanx ! ;)

    C# help debugging tutorial

  • How to open File using System.Diagnostics.Start in the Base Root directory
    N nassimnastaran

    @"..\Debug\HelpFile.pdf"); It's works ! Thanks in advance! Regards !

    C# help debugging tutorial

  • How to open File using System.Diagnostics.Start in the Base Root directory
    N nassimnastaran

    Hi All ! I have a pdf file, place in the debug directory (in any drive) . I want to open this file with any full path :

    string appPath = Path.GetDirectoryName(Application.ExecutablePath);
    Process.Start(appPath + "\\Debug\\HelpFile.pdf");

    But I have an error that can not file file , pl z help me ! thanks in advance !

    C# help debugging tutorial

  • Error in loading excel file in windows 7 ...
    N nassimnastaran

    64 bit

    C# help database

  • Error in loading excel file in windows 7 ...
    N nassimnastaran

    System.InvalidOpertionException:The 'Microsoft.ACE.OLEDB.12.0' provider

    C# help database

  • Error in loading excel file in windows 7 ...
    N nassimnastaran

    Hi all ! in my project to reading an excel file , there is no problem in windows XP , but in Win Seven(7) , I have problem to reading the excel 2007 file . here in some part of code :

    string connectionString = String.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0;HDR=YES;IMEX=1;""", openFileDlgData.FileName);
    string SheetName = "Test";
    string query = String.Format(@"select * from [{0}$]", SheetName);
    try
    {
    OleDbConnection conn = new OleDbConnection(connectionString);
    OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, conn);
    System.Data.DataTable dt = new System.Data.DataTable("ExcelData");
    dataAdapter.Fill(dt);
    ...

    Thanks in any help !

    C# help database

  • Export Mutiple DataGridView to Multiple Sheets in an Excel File ...
    N nassimnastaran

    Hi all ! I want o export 2 datagridview in 2 sheets of An Excel File . some code for one DataGridView is Here :

    ...
    Microsoft.Office.Interop.Excel.Worksheet mySheetInputData = null;
    try
    {
    mySheetInputData = (Microsoft.Office.Interop.Excel.Worksheet)ExWorkBookInputData.Sheets["Sheet1"];

    mySheetInputData = (Microsoft.Office.Interop.Excel.Worksheet)ExWorkBookInputData.ActiveSheet;
    mySheetInputData.Name = "First Sheet";
    

    // storing header part in Excel
    for (int i = 1; i < dgv.Columns.Count + 1; i++)
    {
    mySheetInputData.Cells[1, i + 1] = dgv.Columns[i - 1].HeaderText;
    }
    for (int j = 1; j < dgv.Rows.Count + 1; j++)
    {
    mySheetInputData.Cells[j + 1, 1] = dgv.Rows[j - 1].HeaderCell.Value.ToString();
    }
    // storing Each row and column value to excel sheet

    for (int i = 0; i < dgv.Rows.Count; i++)
    {
        for (int j = 0; j < dgv.Columns.Count; j++)
        {
            mySheetInputData.Cells\[i + 2, j + 2\] = dgv.Rows\[i\].Cells\[j\].Value.ToString();
        }
    }
    //save the application
    string fileNameInputData = String.Empty;
    SaveFileDlgInputData.Filter = "Excel Files (\*.xlsx)|\*.xlsx";
    SaveFileDlgInputData.FilterIndex = 2;
    SaveFileDlgInputData.RestoreDirectory = true;
    
    if (SaveFileDlgInputData.ShowDialog() == DialogResult.OK)
    {
        fileNameInputData = SaveFileDlgInputData.FileName;
        ExWorkBookInputData.SaveAs(fileNameInputData, Type.Missing, Type.Missing,
            Type.Missing, Type.Missing, Type.Missing,
            Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive,
            Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
    
    }
    else
        return;
        ...
    

    thanks for any help

    C# com help

  • importing RowName and ColumnName from an excelfile to a datagridview ...
    N nassimnastaran

    Thanks for your reply , Here is my file , pl z check it . or : www.4shared.com/rar/6WxLLxtL/ReadFromExcelFile.html I've prob yet ! thanks!

    C# help database

  • importing RowName and ColumnName from an excelfile to a datagridview ...
    N nassimnastaran

    Hi All ! I want to Import an Excel File to a DataGridView as FirstRow (Except A1 Cell that's null)will be Column HeaderCell in DataGridView and First Column in Excel file (Except Cell of A1=null) will be Row HeaderCell in DataGridView .Here is my code :

    string connectionString = String.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0;HDR=YES;IMEX=1;""", openFileDialog1.FileName);
    string query = String.Format("select * from [{0}$]", SheetName);
    OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, connectionString);

    DataSet ds = new DataSet();

    dataAdapter.Fill(ds);
    dataGridView1.DataSource = ds.Tables[0];

    int row = ds.Tables[0].Rows.Count;
    int col = ds.Tables[0].Columns.Count;

    for (int i = 0; i < row - 1; i++)
    {
    dataGridView1.Rows[i].HeaderCell.Value = ds.Tables[0].Rows[i].ToString(); ;
    }

    for (int j = 0; j < col - 1; j++)
    {
    dataGridView1.Columns[j].HeaderCell.Value = ds.Tables[0].Columns[j].ToString();
    }

    But I have some Problem for Header Column And Header Row . Thanks For Any Help .

    C# help database

  • how to reduce the size of exe File ...
    N nassimnastaran

    RobCroll wrote:

    Obfuscation will not only make the exe smaller but also protect your IP.

    Really! I didn't know this before ! :omg:

    C# com help tutorial

  • how to reduce the size of exe File ...
    N nassimnastaran

    Hi All ! the size of my exe file is about 1.5 mb .I just used Microsoft.Office.Interop.Excel.dll and Word in preferences. thanks for any help me to introduce a way to decrease the size of Exe file. Regards !

    C# com help tutorial

  • How to input in DataGridView cell Only Double ... or ...
    N nassimnastaran

    thanks , It's a good Lesson ! ;)

    C# question help tutorial

  • How to input in DataGridView cell Only Double ... or ...
    N nassimnastaran

    Hi All , I want to input in DatagridView Cell , Only Double Like 2.36 or 0.035 . how can I do it ? Thanks in Advance for Any Help !

    C# question help tutorial
  • Login

  • Don't have an account? Register

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