|
I have two tables in my table and i want to inser the values in two tables using single queiry is it possible
|
|
|
|
|
To be more clear write an sp to insert data into two tables simultanously
Execute the Procedure
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
hi im developing a mail application.im able to send mail through smtp mail .but my requirement is i have to receive mails thro pop3 .i did that thro this code
try {
// You will need to set these to your settings.
// The settings here are settings for a local
// demo POP3 server
// that I use for testing.
string xHost = "127.0.0.1";
string xUsername = "chad";
string xPassword = "pass";
using (POP3 xPOP3 = new POP3()) {
xPOP3.Username = xUsername;
xPOP3.Password = xPassword;
xPOP3.Connect(xHost);
int xCount = xPOP3.CheckMessages();
if (xCount == 0) {
Console.WriteLine("No messages on account.");
}
else {
Message xMsg = new Message();
xPOP3.Retrieve(1, xMsg);
Console.WriteLine("Subject: " + xMsg.Subject);
Console.WriteLine("From: " + xMsg.From.Text);
Console.WriteLine("To: " + xMsg.Recipients[0].Text);
Console.WriteLine();
Console.WriteLine(xMsg.Body.Text);
}
try {
}
finally {
xPOP3.Disconnect();
}
}
}
catch (Exception e) {
Console.WriteLine(e.Message);
}
Console.WriteLine("");
Console.WriteLine("Press enter");
Console.ReadLine();
but i edited the attributes according to the req but im geting an error like reference is not their for POP3 class .im using system.web.mail name space
please help with this.
hi to all
with regards,
susa
|
|
|
|
|
hello friends
how can i refer the external files from web.comfig files
coolsweety
|
|
|
|
|
You mean you want to place some settings in an external file, and refer to it from the web.config? If so, you can check out the file[^] attribute of the appSettings element.
|
|
|
|
|
hello you all
what I want is to maintain the session of a user when he register or login with us side by side I want to maintain the session for the cart content
neeru
|
|
|
|
|
U can do that by using Session["UserId"]
Creates and stores userid as a Session
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
session["RegNo"]=13;
coolsweety
|
|
|
|
|
yes I know this but I want to maintain it through globle files
|
|
|
|
|
onfiguration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Access is denied: 'Microsoft.Practices.EnterpriseLibrary.Data'.
Source Error:
Line 196: <add assembly="System.EnterpriseServices, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
Line 197: <add assembly="System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
Line 198: <add assembly="*">
Line 199:
Line 200:
Source File: c:\winnt\microsoft.net\framework\v1.1.4322\Config\machine.config Line: 198
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.Practices.EnterpriseLibrary.Data' could not be loaded.
=== Pre-bind state information ===
LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.Data
(Partial)
LOG: Appbase = file:///c:/inetpub/wwwroot/AutoSys/Procurements/Web
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: Microsoft.Practices.EnterpriseLibrary.Data
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/autosys_procurements_web/14145ce2/887b2a67/Microsoft.Practices.EnterpriseLibrary.Data.DLL.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/autosys_procurements_web/14145ce2/887b2a67/Microsoft.Practices.EnterpriseLibrary.Data/Microsoft.Practices.EnterpriseLibrary.Data.DLL.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/AutoSys/Procurements/Web/bin/Microsoft.Practices.EnterpriseLibrary.Data.DLL.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: Microsoft.Practices.EnterpriseLibrary.Data, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null
This error is accuring most commonly.....Any solutions to rectify it?
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
HimaBindu Vejella wrote: Any solutions to rectify it?
You simply copy the assembly Microsoft.Practices.EnterpriseLibrary.Data.dll to the temp folder of your web application:
C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/autosys_procurements_web/14145ce2/887b2a67/
|
|
|
|
|
Hi all,
How to bind the records from sql server tables and display into the HTML table control.
The data should be displayed in the HTML table with all features of datagrid(paging,edit and delete and go to page No).Simply with out using the datagrid.
Pls suggest me with some sample codings.
Thakx
Paul
Paul
|
|
|
|
|
Hi Paul,
The html table control does not support data binding like a data-bound control such as datagrid, datalist ..., so if you want to use the html table, you need to walk through the record collection of the datasource, then build each row (tr) for the table. Also you also need to manage all the built-in features of the datagrid control like paging, sorting ....it seems overhead to you. So I'm curious that why you don't just use the datagrid control.
|
|
|
|
|
Thnak you for your suggession.
But I am trying to do the datagrid functionalty to the html table.
THanks you again
By
Paul
Paul
|
|
|
|
|
Y don't u use DataGrid/List?
"Aim to go where U have never been B4 and Strive to achieve it"
http://groups.yahoo.com/subscribe/dotnetforfreshers
http://himabinduvejella.blogspot.com
|
|
|
|
|
I am tring the code to develop without datagrid/list?
Is it possible to do the same using HTMl Controls??
Paul
|
|
|
|
|
Hi..
I have a DataList that includes in its ItemTemplate an ImageButton which should use FieldNO(a DataItem field in the datasource ) as a QueryString to redirect() to another page:
Response.Redirect("default.aspx?FieldNO="+fieldNO+"&ProjectNO="+projectNO);
But i want this to happen only in a specific situation
(if(searchString!=null) is true) So the DataBinder.Eval() alone wont do what i want.So i used the following code in the method assigned to the OnCommand ImageButton attribute:
string fieldNO;
string argu=e.CommandArgument.ToString();
string[] argss=argu.Split(',');
if(searchString!=null)
{
DataRowView drv=(DataRowView)lProjects.Items[Convert.ToInt32(argss[1])].DataItem;
fieldNO=Convert.ToString(drv["FieldNO"]);
}
Where lProjects is the DataList And the Command Argument of the ImageButton is:
CommandArgument='<%#DataBinder.Eval(Container.DataItem,"ProjectNO")+","+Container.ItemIndex%>'
There is no relation between "ProjectNO" and the problem.The problem exists with the other field "FieldNO"
which i should get it from the datasource of the DataList in a specific condition.
But this code give me the error :
Object reference is not set to an instance.
Sorry if i couldnt explain my problem.
Could any one help?
|
|
|
|
|
+ You can use the ?: operator in the data binding expression to check if you should call the Eval method to populate the command argument.
+ You can wrap your sample code in a method, then simply call it in the data binding expression.
You can see the sample code from here[^].
|
|
|
|
|
These two ideas are exactly what i need.
May you give me code examples for them?...
|
|
|
|
|
You can find the examples from the provided link, and you can easily reuse it for your purpose:
+ Option 1:
<%# (strSearch is not null)? DataBinder.Eval(...):"" %>
+ Option 2:
<%# GetCommandArgument(Container.DataItem) %>
...
you can also define this method in the inline code.
Note: They all are the pseudo code.
|
|
|
|
|
Sorry,i didnt see the last statement in your previous message which was:
"You can see the sample code from here[^]."
Every thing is clear for me now.
Thank you very very much..I wont forget your help.
|
|
|
|
|
TheEagle wrote: Every thing is clear for me now.
Glad to hear you figured it out , good luck to you !
|
|
|
|
|
Hi..
after i build the code in my UserControl it gives me the error:
D:\MyWebApps\EProjects\UserControls\FieldProjectsList.ascx.cs(133): The type or namespace name 'DataBinder' could not be found (are you missing a using directive or an assembly reference?)
It seems to me that the UserControl is different from the WebForm in using the DataBinder class in the code behind page.
Could you help me in this problem?
|
|
|
|
|
Do you include the System.Web.UI namespace in the code-behind of the web user control?:
using System.Web.UI; In case you cannot figure out the problem, you might want to post your sample code in the user control.
|
|
|
|
|
Hi..Sorry for being too late.
After i added:
using System.Web.UI;
The build error disappeared but after i uploaded(updated) the project i got the error message:
Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Specified cast is not valid.
Source Error:
Line 12: <TR>
Line 13: <TD vAlign="middle" align="center">
Line 14: <asp:ImageButton id=ImageButton1 runat="server" OnCommand="gogof" ImageUrl='<%#"~/Epictures/"+DataBinder.Eval(Container.DataItem,"ProjectImage")%>' CommandArgument='<%#GenerateDataBinders(Container.DataItem,Container.ItemIndex)%>' CommandName="topf" BorderStyle="Solid" BorderColor="green">
Line 15: </asp:ImageButton></TD>
Line 16: </TR>
Source File: C:\Sites\Single25\nabeel1eagle\webroot\UserControls\FieldProjectsList.ascx Line: 14
The UserControl code:
namespace EProjects.UserControls
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
/// <summary>
/// Summary description for FieldProjectsList.
/// </summary>
public class FieldProjectsList : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.DataList lProjects;
private void Page_Load(object sender, System.EventArgs e)
{
string searchString=Request.QueryString["SearchString"];
string allWords=Request.QueryString["AllWords"];
string pageNumber=Request.QueryString["PageNumber"];
if(searchString!=null && searchString!="")
{
allWords=Request.QueryString["AllWords"];
pageNumber=Request.QueryString["PageNumber"];
lProjects.DataSource=catalog.SearchProject(searchString,allWords,pageNumber,System.Threading.Thread.CurrentThread.CurrentCulture.Name);
lProjects.DataBind();
}
else
{
BindData();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lProjects.ItemDataBound += new System.Web.UI.WebControls.DataListItemEventHandler(this.lProjects_ItemDataBound);
this.lProjects.SelectedIndexChanged += new System.EventHandler(this.lProjects_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
public void gogof(object s,CommandEventArgs e)
{string searchString=Request.QueryString["SearchString"];
// string allWords=Request.QueryString["AllWords"];
/* if(searchString!=null)
{
lProjects.DataSource=catalog.SearchProject(searchString,allWords);
lProjects.DataBind();
}
else
BindData();*/
//string fieldNO=Request.QueryString["FieldNO"];
string fieldNO=Request.QueryString["FieldNO"];
string fieldIndex=Request.QueryString["FieldIndex"];
string allWords=Request.QueryString["AllWords"];
string pageNumber=Request.QueryString["PageNumber"];
//string allWords=Request.QueryString["AllWords"];
/* if(searchString!=null)
{
lProjects.DataSource=catalog.SearchProject(searchString,allWords,pageNumber,System.Threading.Thread.CurrentThread.CurrentCulture.Name);
lProjects.DataBind();
}
else
BindData();*/
string argu=e.CommandArgument.ToString();
string[] argss=argu.Split(',');
string projectNO;
string projectIndex;
if(e.CommandName=="topf")
{
// Trace.Warn("ProjectProblem",projectNO);
if(searchString!=null && searchString!="")
{
Trace.Warn("FieldProblem",argu);
projectNO=argss[0];
fieldNO=argss[1];
Response.Redirect("default.aspx?FieldNO="+fieldNO+"&ProjectNO="+projectNO);
}
else
{
//Trace.Warn("ProjectNO=",Convert.ToString(argu.IndexOf("+")+1));
// Trace.Warn("IndexProblem=",Convert.ToString(argu.IndexOf("_")));
fieldNO=Request.QueryString["FieldNO"];
fieldIndex=Request.QueryString["FieldIndex"];
projectIndex=argss[1];
projectNO=argss[0];
Response.Redirect("default.aspx?FieldNO="+fieldNO+"&FieldIndex="+fieldIndex+"&ProjectNO="+projectNO+"&ProjectIndex="+projectIndex);
}
}
}
public void BindData()
{
string fieldNO=Request.QueryString["FieldNO"];
lProjects.DataSource=EProjects.AdministratorSite.AdminCatalog.GetFieldProjects(fieldNO,System.Threading.Thread.CurrentThread.CurrentCulture.Name);
lProjects.DataBind();
}
private void lProjects_ItemDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
{
}
private void lProjects_SelectedIndexChanged(object sender, System.EventArgs e)
{
}
public string GenerateDataBinders(object dataItem,int Index)
{string searchString=Request.QueryString["SearchString"];
string projectIndex;
string projectNO;
string fieldNO;
if(searchString!=null && searchString!="")
{
projectNO=(string)DataBinder.Eval(dataItem,"ProjectNO");
fieldNO=(string)DataBinder.Eval(dataItem,"FieldNO");
return projectNO+","+fieldNO;
}
else
{
Trace.Warn("PProjectNO=",Convert.ToString(Index));
projectNO=(string)DataBinder.Eval(dataItem,"ProjectNO");
projectIndex=Convert.ToString(Index);
return projectNO+","+projectIndex;
}
}
}
}
its HTML :
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="FieldProjectsList.ascx.cs" Inherits="EProjects.UserControls.FieldProjectsList" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<asp:datalist id="lProjects" Width="100%" RepeatColumns="2" runat="server">
<ItemTemplate>
<TABLE height="100%" cellPadding="0" width="100%">
<TR>
<TD align="center">
<asp:Label id="Label1" NAME="Label1" Runat="server" CssClass="labelstyle">
<%#DataBinder.Eval(Container.DataItem,"ProjectName")%>
</asp:Label><BR>
</TD>
</TR>
<TR>
<TD vAlign="middle" align="center">
<asp:ImageButton id=ImageButton1 runat="server" OnCommand="gogof" ImageUrl='<%#"~/Epictures/"+DataBinder.Eval(Container.DataItem,"ProjectImage")%>' CommandArgument='<%#GenerateDataBinders(Container.DataItem,Container.ItemIndex)%>' CommandName="topf" BorderStyle="Solid" BorderColor="green">
</asp:ImageButton></TD>
</TR>
<TR>
<TD align="center">
<asp:Label id="Label2" NAME="Label2" Runat="server">
<%#DataBinder.Eval(Container.DataItem,"ProjectDescription")%>
</asp:Label><BR>
</TD>
</TR>
</TABLE>
</ItemTemplate>
</asp:datalist>
I think that the problem in using the Container.ItemIndex.I have made it (int) and beforethis i tried making it object but the same error appeared.
You have helped me all the time thank you very much my teacher.
|
|
|
|