Raggdog
asked on
System.IndexOutOfRangeException: price
Hi Experts
I hope some of you can assist me in this.
My webapplication (asp.net/c#) works like a charm on localhost. But when I put it out on the server I get a server error saying System.IndexOutOfRangeExce ption: price
Highlighted piece of code: "string pris = rdrVarer["pris"].ToString( ).Replace( ",0000", ".00");"
This happens when I click the button to move the items in the basket and place them in the orders table
Can anyone please point me in the right direction here because I don't know what to look for
This is the code behind for this particular button:
I hope some of you can assist me in this.
My webapplication (asp.net/c#) works like a charm on localhost. But when I put it out on the server I get a server error saying System.IndexOutOfRangeExce
Highlighted piece of code: "string pris = rdrVarer["pris"].ToString(
This happens when I click the button to move the items in the basket and place them in the orders table
Can anyone please point me in the right direction here because I don't know what to look for
This is the code behind for this particular button:
// move data from hk to orders
SqlCommand sqlHentvarer = new SqlCommand("select vare_id,cast(pris as numeric(10,2)),storrelse,antall from hk where session_id ='" + Session.SessionID + "'", sqlConn);
SqlDataReader rdrVarer = sqlHentvarer.ExecuteReader();
// make loop
while (rdrVarer.Read())
{
// norwegian vs english configuration
string pris = rdrVarer["pris"].ToString().Replace(",0000", ".00");
SqlCommand sqlSettinnOrdre = new SqlCommand("insert into ordrelinjer (ordre_id,vare_id,pris,storrelse,antall) values ("
+ OrdreID + "," + rdrVarer["vare_id"] + "," + pris
+ "," + rdrVarer["storrelse"] + rdrVarer["antall"] + ")", sqlConn);
sqlSettinnOrdre.ExecuteNonQuery();
}
ASKER
yes... it is the exact same
ASKER
I use the same database both on the server and localhost.
Why is there this works on localmachine - all orders are placed - and not on the server...?
Please people...
Why is there this works on localmachine - all orders are placed - and not on the server...?
Please people...
Hi girl, can you put more details, your stack trace for instance?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@anuragal, thank you...
It works like a charm..
Maya
It works like a charm..
Maya
are you connecting to the exact same database on your development machine and server?