|
mylogics wrote: PID:Autonumber
mylogics wrote: string str1 = "Select MAX(PID) From Product";
OleDbCommand cmd = new OleDbCommand(str1, conn);
OleDbDataReader dr = null;
conn.Open();
string max = cmd.ExecuteScalar().ToString();
if (max != "")
{
max = "PID" + max;
}
else
{
max = "PID" + 1;
}
You have set the PID:Autonumber in database?
If yes then no need to include it in insert/update query. It will be automatically created by database.
Just include the other fields in insert/update query except PID.
HTH
|
|
|
|
|
m not insertin PID in Product table but m inserting ProductID value and it is
necessary as it is primary key and cannot be null.
|
|
|
|
|
Well! i have been struggle with this error! pls help
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase) +0
System.Reflection.Assembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +41
System.Web.UI.Util.GetTypeFromAssemblies(ICollection assemblies, String typeName, Boolean ignoreCase) +119
System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError) +179
System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly) +95
System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData) +192
|
|
|
|
|
|
I am a bit confused about role and membership provider for access database...........whether i need to create all tables manually which was automatically created in sql database........or some script exists for access database also...............plz guide me...
|
|
|
|
|
|
Hi All,
We have 2 sites.
1) suppose that one of the 2 sites has been uploaded under following url:-
http://www.abc.com/
2) we need to read above site web.config for our other site which has uploaded in different location.
http://www.abctest.com/
How do we read 1) site web.config from second site using c#, asp.net?
Thanks in advance.
|
|
|
|
|
Just read the file as XML from the file system path....
|
|
|
|
|
It is not possible to read web.config from one server to another because web.config is assign to each application not to server.
|
|
|
|
|
If it is in another server you need to read it using Unc path.. You cant access Web Config from http requests as they are secure to the web site.
Web config is applied to a virtual directory in the IIS. So you can have web.config file for each folder within your project. If not found it applies the parent.
|
|
|
|
|
string fromdate= "31/08/2009";
string todate = "20/08/2009";
i have to decrase a day for the todate can u plz specify how to decrease the date for one day...
string fromdate ="31/08/2009";
string todate = "20/08/2009";
string newdate =(DateTime.Parse(todate ).AddDays(-1)).ToString("dd/MM/yyyy");
but it was showing error
modified on Monday, August 31, 2009 4:23 AM
|
|
|
|
|
You do not have semi-colons in the first two statements. Is that a typo or the problem?
If that is typo, then post the error message you get.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
its there man
thats not a big issue
|
|
|
|
|
What is the error it is throwing then?
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
it was not reducing the day but it was not reducing the month
|
|
|
|
|
Actually the problem is DateTime parses according to the CultureSettings applied on the computer. If your global Date format is MM/dd/yyyy you cannot parse in dd/MM/yyyy.
You can specify format while parse, using ParseExact function rather than Parse .
|
|
|
|
|
No overload for method 'ParseExact' takes '1' arguments
iam getting dis error
|
|
|
|
|
use this
DateTime dt = DateTime.ParseExact("18/02/2001", "dd/MM/yyyy", new CultureInfo("en-US"));
You will get what you want.
|
|
|
|
|
try this code to decrease the date
Label1.Text = DateTime.Now.AddDays(-1).ToString();
after u Get date time u can change as per your Requirement
modified on Monday, August 31, 2009 5:32 AM
|
|
|
|
|
iam not asking for lable ...
iam getting a date in string format i want to decrease the particular date which is in string format
|
|
|
|
|
Convert the string format date into Datetime format i.e. use the following code
DateTime dt = DateTime.ParseExact("25/11/2009", "dd/MM/yyyy", new CultureInfo("en-US"));
or u Can Use This
string ssd = DateTime.Now.AddDays(-1).ToString();
DateTime asd = Convert.ToDateTime(ssd);
ssd = asd.AddDays(-1).ToString();
if this is not Your Answer I am Sorry..!
modified on Monday, August 31, 2009 6:07 AM
|
|
|
|
|
you can do by this, just remove the opening and closing brace.
string newdate =DateTime.Parse(todate).AddDays(-1).ToString("dd/MM/yyyy");
|
|
|
|
|
Hi ,
First parse string into date format and remember u should use yyyy/mm/dd format.
datetime date = datetime.parse(date);
date = date .AddDays(-1)
Thanks,
Amit Patel
|
|
|
|
|
just get month year day through substring
string year = txtdate.Text.Substring(6, 4);
string month = txtdate.Text.Substring(3, 2);
string day = txtdate.Text.Substring(0, 2);
DateTime dt=DateTime.Parse(year+"/"+month+"/"+day);
string date = dt .AddDays(-1);
|
|
|
|
|
string year = txtdate.Text.Substring(6, 4);
string month = txtdate.Text.Substring(3, 2);
string day = txtdate.Text.Substring(0, 2);
DateTime dt=DateTime.Parse(year+"/"+month+"/"+day);
date = date .AddDays(-1)
txtdate is the textbox for date input
|
|
|
|