|
i have written the query as u said but still givin same error...
|
|
|
|
|
If you passing text with single qoute like D'Souza then replace single quoute with ''.
Be an Eagle, Sky is Yours.
|
|
|
|
|
Hi sir i want to say my code is for text but i want 2 ask u how we use this code for date format.
|
|
|
|
|
Plz explain.
put you code here...
Be an Eagle, Sky is Yours.
|
|
|
|
|
your code is a disaster from start to finish. It has zero chance of working. You should rethink it, and perhaps do some study, so you have a basic idea of what you are doing. you should also read up on paramaterised queries, once your code is not totally useless, it will become totally insecure, due to SQL injection attacks. Once you fix that, it will also work for dates, as a side benefit.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Well, this has to be the most ridiculous code I've seen in a long time.
mylogics wrote: txt[i] = new TextBox();
txt[i].ID = "txt" + i.ToString();
string s1 = txt[i].Text;
string s2 = "Insert Into ProductSpecification(Value)Values('"+s1+"')";
Well, why would you expect s1 to be anything, but an empty string ? What on earth are you expecting here ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
i want to devlop a virtual tele phone which is acts like a normal phone using computer only.
in this we design a key board on the screen and when i press a number it goes to call .the number will be saved after .all of the application i want to done in ASP.Net .But i search in many sites it is not able to devlop TAPI (Telephony Appliacation Programming Inter face)in ASP.Net .
So i want to devlop TAPI in JAVA and then using that files how can implement virtual phone using ASP.Net application.
|
|
|
|
|
kareemmahammed wrote: So i want to devlop TAPI in JAVA and then using that f
This question has nothing to do with ASP.NET. I assume you want to write a java applet. In that case, if you use ASP.NET to write the page that holds the applet or not, is irrelevant to your overall goal.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
here is my code whenever i want to change the value of my dropdownlist i select only first value it can't
change to any other value. plz chk and reply
private void bounddropdownlist()
{
string query = "select CouponName,CouponTypeID from CouponType";
DAL Helper = new DAL();
Helper.ConnectionString = ConfigurationManager.AppSettings["ConnectionString"].ToString();
ds = new DataSet();
ds = Helper.ExecuteDataSet(CommandType.Text, query, null);
ddlCType.DataValueField = "CouponTypeID";
ddlCType.DataTextField = "CouponName";
ddlCType.DataSource = ds;
ddlCType.DataBind();
}
|
|
|
|
|
Well, again, your code really sucks. You need to abandon this project, and work on something more simple while you are just learning and cannot write commercial quality code. You seem to not know anything about ASP.NET and how it works yet.
haleemasher wrote: ddlCType.DataBind();
Every time you do this, the selected index is reset. I assume you call it in page load, and it therefore runs prior to your event, which is the problem.
haleemasher wrote: string query = "select CouponName,CouponTypeID from CouponType";
DAL Helper = new DAL();
Helper.ConnectionString = ConfigurationManager.AppSettings["ConnectionString"].ToString();
ds = new DataSet();
ds = Helper.ExecuteDataSet(CommandType.Text, query, null);
This is an absolute joke.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
u mean i will write
ddlCType.DataBind(); in page load or i write all my code in pageload????
|
|
|
|
|
I assume this method is being called by pageload now ? What is calling it ?
I am saying if you do this in page load, or any time prior to trying to access the selection, it will reset the selection. In fact, you should use IsPostback blocks to only load the data the first time, after that, it is in viewstate
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I think DataSet and DataTable are the most misused classes in .NET framework.
|
|
|
|
|
Well, for a class called DAL to require a connection string AND SQL, just beggars belief. The sad thing is, someone somewhere is paying for this code, and I am certain he will ignore what I said, and deliver a project that is poorly written, unmaintainable, and totally insecure.
You have to wonder who is basing their inventory systems, staff management and other vital functions to this sort of third rate beginner code, and, worse, if the bad job being done by these people, will end up reflecting on how dumb managers view you and I, people who have done the work to learn how to write professional code, before presuming to charge money for our efforts.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: and deliver a project that is poorly written, unmaintainable, and totally insecure.
Whatever Christian is pointed out is right but If proper code review is there it won't happen. right?
|
|
|
|
|
i want to submit data in a database using a button (submit) while entering data i got an exceptionDB Exception Error converting data type varchar to numeric plz chk this code and help me that where i is the error.these are its data type
CouponTypeID tiny int
TransactionDate datetime
TransactionTypeID numeric(18,0)
description text
CafeMenu nvarchar(50)
SerialEnd Bigiint
SerialStart Bigint
Price int
TotalSale int
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
ErrorMessage.Text = "";
string query = "insert into CouponTransaction(CouponTypeID,TransactionDate,TransactionTypeID,Description,CafeMenu,SerialStart,SerialEnd,Price,
TotalSale)values('" + ddlCType.SelectedValue.ToString() + "','"+ TxtbxDate.Text
+"','"+ddlTtype .SelectedValue .ToString ()+"','"+TxtDes .Text +"',
'"+ddlMenu .SelectedValue+"','"+txtSFrom .Text +"','"+TxtEnd .Text +"','"+Txtprice .Text +"','"+TxtSale .Text +"')";
DAL helper = new DAL();
helper.ConnectionString = ConfigurationManager.AppSettings["ConnectionString"].ToString();
int result = helper.ExecuteNonQuery(CommandType.Text, query, null);
if (result == 1)
ErrorMessage.Text = "Records inserted successfully";
else
ErrorMessage.Text = "Records could not be inserted";
cnx.Close();
}
catch (Exception ex)
{
ErrorMessage.Text = ex.Message;
}
}
|
|
|
|
|
This is horrible code. I hope you're just experimenting to teach yourself, because if someone is paying for this code, they are being robbed.
You should choose a more simple project to experiment with while you are just learning. There's too much going wrong here, too many things to address. Some basic points:
1 - I can erase the database on your website whenever I like, because you have NO security. You need to buy some books and read them, and you need to google injection attacks, there's at least one great article here on CP
2 - you also need to buy a book on ADO.NET and read it. Also, you need to read your error messages, which are in plain english, and either google them, or at least stop to think what they may mean. The issue here, is that you are placing your number in quotes, which means it becomes a string, hence the (very explicit and clear ) error message you are getting
3 - Given that you're accepting numbers in text boxes, are you doing anything to deal with the possibility of someone entering text ? I doubt it, I thnk your code will just blow up
4 - You should write simplified error messages to an end user, not give them an exception verbatim. Log the real error for your own use
5 - your data layer is crap. If it was a real data layer, you would not be writing SQL in the presentation layer, or looking up a connection string. In fact, I can't see what your so called data layer is doing at all.
There's nothign wrong with learning. As I said, if you are doing this for money, you are a liar and a cheat, you have no idea how to program yet. But, if you're learning, then experimenting AND buying books/reading articles is the way to go. Choose something simpler to learn from, get some decent resources, and you will be fine. You're at least a year from writing anything that anyone in their right mind would pay for, however.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Its now working. Thread end
|
|
|
|
|
What a weird response. So, do you mean that you fixed all the security holes and other bugs in your software, or just that you removed the quotes in your SQL ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Thanx 4 ur kind suggestions. I will try my best to work on the issues u have mentioned in ur reply.
|
|
|
|
|
I had missed something in ASP.NET.
Looking for info on the below:
1. What's the purpose of tag <%#....%>, we mention in aspx file.
2. WHat's the purpose of template column?
3. Whats'the diff bewteen ItemTemplate and EditItemTemplate
4. What's the diff between <%#Eval("myColumn")%> and <%#Bind("myColumn")%>? Which to use and when?
|
|
|
|
|
Do they not make books where you live ? Does google not work where you live ?
1 - it's for embedding code
2 - to define a template for a databound control
3 - one is to show data and one is to edit data
4 - I'm not sure, but I am certain if I googled I could find out.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I have a web app that uses cookies. Seems that IE8 doesn't handle having multiple sessions to my application - one session per tab. I think the cookies are part of the problem. Anybody else have this problem? Anyone have a work-around?
Rob
tagyurit.com
|
|
|
|
|
If you're using cookies, I can see how that would be an issue. You'd have to put the session id into the cookie name to have a cookie per session, I'd think.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Currently I have a web hosting solution with "Network Solutions" and I have various sub domains created there. The web sites are all straight HTML and work perfectly.
Now, I want to deploy an ASP.NET application on one of the sub domains and I'm getting a problem because the code-behind can't seem to find my custom class.
I know that the web-server is running IIS 6.0 and .NET 2.0, and I can verify that it will run a simple .aspx page which has a Page_Load code behind of:
Me.TextBox1.Text = Now.ToLongDateString
When I use the following code, Me.TextBox1.Text = HttpContext.Current.Request.PhysicalApplicationPath.ToString() it returns
"E:\0\0\112\153\275968\user\280245\htdocs\"
The twist is that my "hello.aspx" page is deployed in a sub domain in a folder called, "\htdocs\ppsm". This makes me believe that the \htdocs folder is considered the application root directory.
Question: How can I get an ASP.NET applicaiton deployed in \htdocs\ppsm to find the \htdocs\ppsm\bin folder ? Is there something I can do in the web.config ?
Thanks,
David
|
|
|
|
|