or
Hi all,
hop any one can help me,
i am using the following coding to upload files to the sqlserver dirctly no need to save, but i get error on line
{
byte[] imgbytes = new byte
try
{
DB.Image("insert into projectsimages (image,id) values(@picture,'1')"
, imgbytes);
}
I have noticed that my Event Viewer is being filled up with the following warnings, complaining about NullReferenceException. Can someone tell me what could be causing this, and what can I do to fix them?
Thanks,
| Event Type: Warning |
| Event Source: ASP.NET 2.0.50727.0 |
| Event Category: Web Event |
| Event ID: 1309 |
| Date: 3/23/2010 |
| Time: 9:45:05 AM |
| User: N/A |
| Computer: WEBPC |
| Description: |
| Event code: 3005 |
| Event message: An unhandled exception has occurred. |
| Event time: 3/23/2010 9:45:05 AM |
| Event time (UTC): 3/23/2010 2:45:05 PM |
| Event ID: ac0df0b9829a4b0796ff2693875efb70 |
| Event sequence: 261544 |
| Event occurrence: 1492 |
| Event detail code: 0 |
| Application information: |
| Application domain: /LM/W3SVC/2/Root-1-129137505216865130 |
| Trust level: Full |
| Application Virtual Path: / |
| Application Path: C:\Inetpub\wwwroot\WEBPC\WebSite\ |
| Machine name: WEBPC |
| Process information: |
| Process ID: 7480 |
| Process name: w3wp.exe |
| Account name: NT AUTHORITY\NETWORK SERVICE |
| Exception information: |
| Exception type: NullReferenceException |
| Exception message: Object reference not set to an instance of an object. |
| Request information: |
| Request URL: http://www.thegreensheet.com/Telerik.Web.UI.WebResource.axd?imgid=2b66498078e24ceab80cfe456aff0d17&type=rbi |
| Request path: /Telerik.Web.UI.WebResource.axd |
| User host address: 928.54.83.66 |
| User: default\Anonymous |
| Is authenticated: False |
| Authentication Type: |
| Thread account name: NT AUTHORITY\NETWORK SERVICE |
| Thread information: |
| Thread ID: 7 |
| Thread account name: NT AUTHORITY\NETWORK SERVICE |
| Is impersonating: False |
| Stack trace: at Telerik.Web.UI.RadBinaryImageHandler.ProcessRequestInternal() |
| at Telerik.Web.UI.HandlerRouter.ProcessHandler(String handlerKey, HttpContext context) |
| at Telerik.Web.UI.WebResource.ProcessRequest(HttpContext context) |
| at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() |
| at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) |
e.Item.IsInEditMode =
true
in the ItemUpdated event of the grid; but this event will not fire in my case...since i knew that this event will fire only in case of automatic operations is enabled.
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnablePageHeadUpdate="False"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="lnkbutton"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadTreeView1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager><telerik:RadTreeNode Value="pcomment"> <NodeTemplate> <telerik:RadTextBox runat="server" Width="250px" ID="postcomment"></telerik:RadTextBox> <asp:Button Text="Post" runat="server" ID="lnkbutton" onclick="lnkbutton_Click" ></asp:Button> </NodeTemplate> </telerik:RadTreeNode>protected void RadTreeView1_NodeExpand(object sender, RadTreeNodeEventArgs e) { string getc = "SELECT [User].Name, [User].ID, Comments.ID AS CID, Comments.Comment, Comments.ItemID, Comments.UID, [User].T28 FROM [User] INNER JOIN Comments ON [User].ID = Comments.UID WHERE (Comments.ItemID = 271)"; dt = dbClass.ReturnDT(getc); if (dt.Rows.Count > 0) { int n = dt.Rows.Count; for (int m = 0; m < n; m++) { RadTreeNode onDemandNode = new RadTreeNode(); onDemandNode.ImageUrl = dt.Rows[m]["T28"].ToString(); onDemandNode.Text = "<u><b><a href='Profile/profile.aspx?Id="+dt.Rows[m]["ID"].ToString()+"'>"+dt.Rows[m]["Name"].ToString()+"</a></b></u> "+ dt.Rows[m]["Comment"].ToString(); onDemandNode.ExpandMode = TreeNodeExpandMode.ClientSide; //Add the node as a child of the currently expanded node RadTreeView1.Nodes.FindNodeByText("Comments").Nodes.Add(onDemandNode); } }
}
protected void lnkbutton_Click(object sender, EventArgs e)
{
RadTextBox tb= (RadTextBox)RadTreeView1.Nodes.FindNodeByValue("pcomment").FindControl("postcomment");
string insertcomment = " INSERT INTO Comments (ItemID, UID, Comment) VALUES (271, "+Session["UserId"]+", '"+tb.Text+"')";
dbClass.DataBase(insertcomment);
}