Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SharePoint > SharePoint Development
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SharePoint Development Programming and development for SharePoint Portal Server and Windows SharePoint Services
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SharePoint Development section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 19th, 2008, 04:17 AM
Authorized User
 
Join Date: Jun 2007
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error in Sharepoint Webpart

Hi all,

    1. I am working in Microsoft Office Sharepoint application.
    2. In that application, .NET application pages are moved to
       sharepoint and successfully run in sharepoint site.
    3. In my sharepoint site, webparts are created using ".NET sharepoint weparts template"
       using Miscrosoft Visual Studio 2005.
    4. In that webpart, employee ID of employee who currently logged in is retrieved from
       SQL Server Database.
    5. While checking database, if resultset is 0, then iam getting a server error 'Cannot find table name'.
    6. But Iam not getting error while resultset is 0 if I run it as a .net application instead of sharepoint webpart.

       The code I used is following:




namespace HRAdminTask
{
    [Guid("66d01870-8e75-4950-99d3-6ca79f072694")]
    public class HRAdminTask : Microsoft.SharePoint.WebPartPages.WebPart
    {
        Common objcom = new Common();
        ReturnUser objReturnUser = new ReturnUser();
        int supervisorId = 0;
        int deptId = 0;
        public HRAdminTask()
        {
            this.ExportMode = WebPartExportMode.All;
        }



        protected override void Render(HtmlTextWriter writer)
        {
            // TODO: add custom rendering code here.
            // writer.Write("Output HTML");
             SPWeb web = SPContext.Current.Web;
             SPUser user1 = web.CurrentUser;

             string[] arUser = new string[100];

             arUser[0] = user1.LoginName;
             int chk = 0;
             string user = "";
             for (int i = 0; i < arUser[0].Length; i++)
             {
                 if (arUser[0].Substring(i, 1).ToString() == @"\")
                 {
                     chk = 1;
                 }

                 if (chk == 1 && arUser[0].Substring(i, 1).ToString() != @"\")
                 {
                     user = user + arUser[0].Substring(i, 1).ToString();

                 }
             }


             Int64 empIDCount = Convert.ToInt64(SqlHelper.ExecuteNonQuery(objcom.D bConnection, CommandType.StoredProcedure, "uspGetEmpJPIIDCount",
                 new SqlParameter("@UserName",user)));
             if (empIDCount > 0)
             {
                 Int64 empid = Convert.ToInt64(SqlHelper.ExecuteNonQuery(objcom.D bConnection, CommandType.StoredProcedure, "uspGetEmpJPIID",
                     new SqlParameter("@UserName", user)));
                 Page.Session["user"] = empid.ToString();

         }
         else
             {
                 writer.Write("Your account have not been activated");
             }



    7. I am getting error even if I use try..catch statement.

        Please help me and give a solution for this.

Thank You,
Subhashini Palanivel.



Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
error compiling link usercontrol inside sharepoint mcarola ASP.NET 2.0 Professional 0 December 4th, 2008 02:51 PM
Sharepoint-- webpart to find out who all have loog sindia Visual Studio 2005 0 April 27th, 2007 01:18 AM
Sharepoint Search Error x_ray SharePoint Development 1 April 17th, 2007 04:03 PM
WebPart rrsparihar ASP.NET 2.0 Professional 0 October 4th, 2006 12:20 AM
webpart sawjansee BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 0 June 18th, 2006 12:12 AM



All times are GMT -4. The time now is 08:28 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.