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
P

pranavcool

@pranavcool
About
Posts
31
Topics
30
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • grouping rows in gridview...
    P pranavcool

    Hi, I have to show some data in gridview group wise. I an having 2 sql tables with some data as shown below.

    Table 1

    Empid Empname
    01 abc
    02 xyz
    03 pqr

    Table 2

    Assign1 Empid Assignment
    01 01 Assign1
    02 01 Assign2
    03 01 Assign3
    04 02 Assign1
    05 03 Assign1

    above is the table structure. Now i want to display it in gridview employee name wise as shown below.

    Name Assignment
    abc Assign1
    Assign2
    Assign3
    xyz Assign1
    pqr Assign1

    i want to display it in grid view name wise i.e i want to group assignments by employee name and show it in gridview. i an sql server 2005 as database. Any suggestion or code snippet or useful link representing above will be useful. Thanks and regards,

    Pranav Dave

    ASP.NET database css sql-server sysadmin

  • Find and mark area in bing maps....
    P pranavcool

    Hi, I am currently using bing maps. There is one text box and a search button which will find the location on bing maps. I have already done with that, it is finding the location properly, when i enter the location/address in textbox and click on the search button.But, i want to mark that location using polygon shape. It means when i enter the address in textbox and hit the search button it will find the desired location and mark that area in polygon or circle shape. How can i achieve that. Can any one provide me some code or some useful link which can help me out. regards, Pranav dave.

    Pranav Dave

    C# help question

  • Gridview with subheaders below....
    P pranavcool

    Hi, I have a grid view to which i am binding data from the employees table. I am also displaying first name and last name in grid view. now i want the first name and last name under one main sub header name. Below is the example.

    EmployeeId ContractNo ContactNo EmployeeName Summary
    First Last

    E001 Co123456 900878634 Xyz Abc PQR

    I the above example i want First and Last below the EmployeeName as a subheader, means EmployeeName acts as a main header for First and last. I also need to provide sorting on EmployeeName. Can any one suggest me a solution by some code example or some useful link regarding this in order to provide subheader inside one main header in the same format. solution will be highly appreciated. Regards,

    Pranav Dave

    ASP.NET css wpf wcf algorithms tutorial

  • restrict data by lines...
    P pranavcool

    Hi, I have span tag in HTML. I am retrieving some data from the database and showing it in the span tag. For e.g

    this is code project this is code project this is code project
    this is code project this is code project this is code project
    this is code project this is code project this is code project
    this is code project this is code project this is code project
    this is code project this is code project this is code pro ...

    Now currently i am restricting the data by number of characters. Now i want to restrict the data by number of lines instead of number of characters. I want to restrict the data by 5 lines only. If the data is more it will show an ellipse at the end of the fifth line and it would be a hyperlink which will navigate to another page showing the whole data. Currently The functionality is working fine by number of characters. But the problem is that if the data contains some bold of capital letters it will show the the data in 6 lines instead of 5 lines and in turn it will spoil the design part. Now my concern is to restrict the data by number of lines instead of number of characters. No matter however may be the data it will restrict the data by 5 lines only and i want to do it by using span tag or div tag or by using HTML table only. So how it is possible using the span, div or HTML tag. Please provide some solutions for the same or provide some useful link containing the following or some useful code to achieve this. Regards,

    Pranav Dave

    ASP.NET html database design help

  • Link in Textarea.......
    P pranavcool

    Hi, I have a textarea. This textarea is getting some records from the database. The data also contains some hyperlinks and it should be clickable, say for example i am having a text as below.

    To download the content, click here.

    Now click here is a hyperlink redirecting to another site when clicked. now this this link is not appearing as a hyper link in my textarea. Instead of that it is appearing as a plain text in my text area without the actual hyperlink. How it is possible to get click here text to appear as hyprerlink in my textarea. Regards,

    Pranav Dave

    ASP.NET database tutorial

  • Problem with the french character with sql server 2005
    P pranavcool

    Hi, I am facing some problems related to french characters. One of the character "₣" is not supported by sql server 2005. rest of the french characters is suppoeted by sql server 2005. When ever i tried to insert data or run a select query it returns as a question mark "?". Full text search is provided on table for search functionality.

    Select doc_id,1 from DocumentMaster Where 1=1
    AND (CONTAINS(Document_Filename, '"*Œ*"') OR CONTAINS(Document_Filename_French, '"*Œ*"'))
    AND (CONTAINS(Document_Filename, '"*œ*"') OR CONTAINS(Document_Filename_French, '"*œ*"'))
    AND (CONTAINS(Document_Filename, '"*€*"') OR CONTAINS(Document_Filename_French, '"*€*"'))
    AND (CONTAINS(Document_Filename, '"*?*"') OR CONTAINS(Document_Filename_French, '"*?*"'))

    i have read in couple of the site that the data type of the colum should be nvarchar or ntext for french characters to support. I even that. but then also it is not supporting the "₣" french character. Rest french character it is supporting. please suggest any solution. Regards,

    Pranav Dave

    Database database question sql-server sysadmin json

  • Transaction problem in asp.net
    P pranavcool

    Hi, I am am using commit and rollback transaction in asp.net. due to some reasons transaction is not working.In the following code i am deleting the record and then inserting new record.If the transaction fails the transaction will be rollback.but it is not rolling back the transaction. The following is the code:-

    public static void insertdata()
    {
    string strfilename = "~\\Documents\\" + ViewState["MissionCat"];
    string strexcelConnectionString=@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath(strfilename) + "; Extended Properties=\"Excel 8.0;HDR=YES;IMEX=1;\"";
    string strsqlConnectionString = ConfigurationManager.ConnectionStrings["conn"].ToString();

        using (OleDbConnection connection = new OleDbConnection(strexcelConnectionString))
            {
                connection.Open();
                OleDbCommand command = new OleDbCommand("Select \[Mission\] ,\[Civilian\] ,\[Military\] ,\[Police\],\[Unknown\] ,\[Non-UN\] ,\[Total\] FROM \[Sheet1$\]", connection);
                //truncate the table before inserting new data.
                SqlConnection cnntrunc = new SqlConnection(strsqlConnectionString);
                //open the connection.
                cnntrunc.Open();
                //begin the transaction.
                SqlTransaction myTrans = cnntrunc.BeginTransaction();  //New a transaction                        
                SqlCommand truntble = new SqlCommand();
                truntble.Transaction = myTrans;
                truntble.Connection = cnntrunc;
                try
                {
                    //Create DbDataReader to Data Worksheet.
                    using (DbDataReader dr = command.ExecuteReader())
                    {
                        truntble.CommandText = "DELETE FROM MissionCatReport";
                        truntble.ExecuteNonQuery();
                        //commit the transaction.
                        myTrans.Commit();
                        //Bulk Copy to SQL Server.
                        using (SqlBulkCopy bulkCopy = new SqlBulkCopy(strsqlConnectionString))
                        {
                            bulkCopy.DestinationTableName = "MissionCatReport";
                            bulkCopy.WriteToServer(dr);
                        }
                    }
                }
                catch (OleDbException ex)
                {
                    myTrans.Rollback();
                    throw ex;
                }
                catch (Inv
    
    ASP.NET csharp asp-net database sql-server sysadmin

  • check datatype in SqlBulkCopy
    P pranavcool

    Hi, I am inserting data from excel sheet to sql server table. The following is the code which is used to export data from excel ti sql server table.

    private void insdata()
    {
    try
    {
    string filename = "~\\Documents\\" + ViewState["MissionCat"];
    string excelConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath(filename) + "; Extended Properties=\"Excel 8.0;HDR=YES;IMEX=1;\"";

                // Create Connection to Excel Workbook
                using (OleDbConnection connection = new OleDbConnection(excelConnectionString))
                {
                    connection.Open();
    
                    OleDbCommand command = new OleDbCommand("Select \[Mission\] ,\[Civilian\] ,\[Military\] ,\[Police\]" +
                     ",\[Unknown\] ,\[Non-UN\] ,\[Total\] FROM \[Sheet1$\]", connection);
    
                    string sqlConnectionString = ConfigurationManager.ConnectionStrings\["conn"\].ToString();
    
                    //truncate the table before inserting new data.
                    SqlConnection cnntrunc = new SqlConnection(sqlConnectionString);
                    SqlCommand truntbleBU = new SqlCommand();
                    truntbleBU.Connection = cnntrunc;
                    string trunsqlBU = null;
                    trunsqlBU = "TRUNCATE TABLE MissionCatReport";
                    truntbleBU.CommandText = trunsqlBU;
                    cnntrunc.Open();
                    truntbleBU.ExecuteNonQuery();
                    cnntrunc.Close();
    
                    // Create DbDataReader to Data Worksheet
                    using (DbDataReader dr = command.ExecuteReader())
                    {
                        // Bulk Copy to SQL Server
                        using (SqlBulkCopy bulkCopy = new SqlBulkCopy(sqlConnectionString))
                        {
                            bulkCopy.DestinationTableName = "MissionCatReport";
                            bulkCopy.WriteToServer(dr);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    

    There is numeric field in table such as total. Now i am getting an error when a user tries to export data from excel to sql table if the total column in excel sheet contains string value instead of numeric value because the total column in sql table is numeric. I want to keep the total column in sql tabl

    ASP.NET database sql-server sysadmin help

  • How to delete multiple records at one time using LINQ
    P pranavcool

    I know I can use the SQL delete recorde at one time

    Delete * from my table where ID in (5,9,58,7)

    If I use LINQ, I have to write

    var result = from r in db.Role where (r.ID =5) or (r.ID =9) or (r.ID =58) or (r.ID =7) select r;
    db.Role.DeleteAllOnSubmit(result);
    db.SubmitChanges();

    Is there a simple way (another way) to do that in LINQ?

    Pranav Dave

    LINQ database csharp linq tutorial question

  • LINQ to dataview........
    P pranavcool

    Hi, I have written a linq query and bind it to a gridview. Now i want to implement sorting on gridview columns for which i want this linq query to store in dataview. So how it is possible to store linq query in dataview. the following is the code which i have written to bind gridview.

        protected void BindGrid()
        {
            try
            {
                var employees = from e in DetailContext.Employees orderby 
                e.Emp\_Code descending 
                select new {e.Emp\_Id,e.Emp\_Code,e.F\_Name,e.L\_Name,e.Designation };
                GridView1.DataSource = employees;                
                GridView1.DataBind(); 
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }  
    

    Pranav Dave

    ASP.NET csharp database linq algorithms

  • LINQ to dataview........
    P pranavcool

    Hi, I have written a linq query and bind it to a gridview. Now i want to implement sorting on gridview columns for which i want this linq query to store in dataview. So how it is possible to store linq query in dataview. the following is the code which i have written to bind gridview.

        protected void BindGrid()
        {
            try
            {
                var employees = from e in DetailContext.Employees orderby 
                e.Emp\_Code descending 
                select new {e.Emp\_Id,e.Emp\_Code,e.F\_Name,e.L\_Name,e.Designation };
                GridView1.DataSource = employees;                
                GridView1.DataBind(); 
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }  
    

    Pranav Dave

    LINQ csharp database linq algorithms

  • Retrive file path back in to fileupload control......
    P pranavcool

    Hi, I am using a fileupload control in my .net project.I am storing the file name in to the database. Now my question is that it is possible to retrive the filename will full path back in to the fileupload while updating the record. For example i am storing a file name "xyz.jpg" in to the database.And the file is stored in some folder say ../images/xyz.jpg. so is it possible to get back the full path with the file name back in to the fileupload control. If it is possible please let me know. Regards, Pranav

    Pranav Dave

    ASP.NET csharp database tutorial question

  • Display image in Detailsvew control....
    P pranavcool

    Hi, I have never used this control.Cay any one tell me:- 1) how to display image in detailsview control.I have store that image path in database.I want to display that image using the path store in that database. 2) and i want to hide columns of the detailsview control.Is it possible?.If yes how it is possible. Can any one provide me the example..........if possible. Thanks in advance. Regards, Pranav.

    Pranav Dave

    ASP.NET tutorial database question

  • sorting in gridview using linq.........
    P pranavcool

    hi abhishek, I totally agree with u.The order by clause is used to order the linq data. But my question is that there are some data displayed in gridview and i want to apply sorting and paging on gridview with the help of linq because i have bind the gridview with the help of linq.I have already applied paging on gridview but unable to apply sorting on gridview columns as we normally do with the help of dataset or dataview. i have already tried many ways and did lot of googling but still unable to find the solutions to apply sorting on gridview columns with the help of linq. If you could please suggest some solutions to me. regards, pranav

    Pranav Dave

    LINQ help csharp linq algorithms

  • sorting in gridview using linq.........
    P pranavcool

    Hi, I am new to linq and using it for the first time. I am stuck up in the middle of the project. I want to do sorting in gridview using LINQ. Can anyone help me out.Can anyone provide me the sample code or any useful link to do this. I have done a lot of googling ,but enable to find perfect solution to this. here is the sample code which i have used to bind gridview.

    protected void BindGrid()
    {
    try
    {
    var employees = from e in DetailContext.Employees select new {e.Emp_Id,
    e.Emp_Code, e.F_Name, e.L_Name, e.Designation };
    GridView1.DataSource = employees;
    GridView1.DataBind();
    }
    catch (Exception ex)
    {
    throw ex;
    }
    }

    Pranav Dave

    LINQ help csharp linq algorithms

  • checking duplicate rows using linq while inserting data.........
    P pranavcool

    Hi, I am using LINQ for the first time.I have written a code in LINQ that will insert employees details in to the database. Now the problem is that i do not want to insert duplicate data(employee details) in to the database. How do i check duplicate data using LINQ before new inserting data. I want to check the first name and last name of employee in table before inserting new data.If the record(e.g first name and last name) exist then it will show some message.. The following is the code that i am using to insert data in to the table....

    EmployeesDetailsDataContext DetailContext = new EmployeesDetailsDataContext();
    Employee tblemp = new Employee();
    tblemp.Emp_Code = txtEmpId.Text.Trim();
    tblemp.F_Name = txtFname.Text.Trim();
    tblemp.L_Name = txtLname.Text.Trim();
    tblemp.Country = Convert.ToInt32(ddlCountry.SelectedValue);
    tblemp.State = Convert.ToInt32(ddlRegion.SelectedValue);
    tblemp.City = Convert.ToInt32(ddlCity.SelectedValue);
    tblemp.Designation = txtDes.Text.Trim();
    tblemp.Address = txtAdd.Text.Trim();
    DetailContext.Employees.InsertOnSubmit(tblemp);
    DetailContext.SubmitChanges();

    any help would be appreciate

    Regards, Pranav Dave

    LINQ help csharp database linq question

  • cursor goes in to infinit loop.........
    P pranavcool

    hi, I have written a cursor that goes into infinite loop. I am not able to make out where i have done wrong. the following is the code. /******************************************************************************/ declare @dirid int declare @topic varchar(8000) create table #topic(Dir_Id int,topic_Id varchar(1000)) insert into #topic(Dir_Id,topic_Id)select D.Dir_Id,D.topicid FROM Category CN INNER JOIN directory D ON CN.Cat_Id = D.OrgType_Id INNER JOIN SubCategory SB ON D.Country = SB.SubCat_ID WHERE CN.Cat_Name = 'Academic' declare curtopic cursor for select Dir_Id,topic_Id from #topic open curtopic fetch next from curtopic into @dirid,@topic begin while @@fetch_status = 0 set @topic = '' SELECT @topic = topic_Id from #topic fetch next from curtopic into @dirid,@topic end close curtopic deallocate curtopic print @topic drop table #topic /****************************************************************************/ i want to retrieve the data row by row for which i have written cursor. but it is going in to infinite loop. any help would be great full. regards, pranav

    Pranav Dave

    Database

  • Load XML file in the sql server 2005 table......
    P pranavcool

    Hi, I want to load xml file i to the sql server 2005 table. Foe e.x i have a xml file containing details '<'employee'>' '<'firstname'>'abc'<'/firstname'>' '<'lastname'>'xyz'<'/lastname'>' '<'/employee'>' now i want to load this data into the table in sql server 2005 database. The table contains 2 columns: firstname and lastname i want to load this xml data to this table in to the corresponding column. so is it possible through T-sql query.ID yes,please let me know and if not please give me some alternative to load this xml data in to the table. Regards, pranav.

    Pranav Dave

    Database database sql-server sysadmin xml

  • Password Validation....
    P pranavcool

    Hi, I have a form Changepassword.aspx. In that i have password field.I want that password field should accept at least 1 numeric 1 alphanumeric and it should be minimum 7 characters long and maximum 20 characters. how can i do that using java script or in c#. Please provide any helpful link related to this or provide me some code to achieve this task. regards,

    Pranav Dave

    ASP.NET csharp java tools question

  • Dropdown list ,pass parameter in linq........
    P pranavcool

    Hi, I am new to .net 3.5. Currently i am stuck up in middle of the project. I have got two dropdownlist.One is country and other is region. Based on the country (first dropdownlist) the values in the region (second dropdownlist) should get populated. I have already written a linq query to bind country dropdownlist, but based on the country selected, region dropdownlost should be populated. Now my query is that how to pass the value in to the linq query to populate the region dropdown base on the country selected from the dropdownlost. suggestion would be appreciated. Waiting for an early reply. Regards,

    Pranav Dave

    LINQ csharp database linq 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