|
Vista
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Yes that's why it works in Properly.This Code does not work for Xp
So Manas thank u
|
|
|
|
|
I assume you're on XP and the documentation on MSDN clearly states this has no effect on XP.
|
|
|
|
|
|
Two things:
1) If you want us to look at code, make it easy for us: use the "Code block" button (above) or enclose it in <pre></pre> tags. We don't get paid, so won't want to struggle too hard.
2) Ask a question. Just code doesn't often get an answer - we don't know what your problem is (apart from "He doesn't like commenting").
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
public partial class Default2 : System.Web.UI.Page
{
SqlConnection cnx = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|Coupon Management.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
SqlDataAdapter da1 = new SqlDataAdapter();
DataSet ds = new DataSet();
SqlCommand cmd = new SqlCommand();
DataTable dataTable;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FillVendorGrid();
}
}
private void FillVendorGrid()
{
dataTable = new DataTable();
cmd.Connection = cnx;
cmd.CommandText = "SELECT Coupon_Info.RecievingDate, CouponType.CouponName, Coupon_Info.Serial_Start, Coupon_Info.Serial_End, Coupon_Info.Recieved_By FROM Coupon_Info INNER JOIN CouponType ON Coupon_Info.Coupon_TypeID = CouponType.CouponTypeID";
da1 = new SqlDataAdapter(cmd);
da1.Fill(dataTable);
GridView1.DataSource = dataTable;
GridView1.DataSource = ds;
GridView1.DataSourceID = String.Empty;
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
FillVendorGrid();
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
cmd.Connection = cnx;
cmd.CommandText = "DELETE FROM Coupon_Info WHERE RecievingDate='" + GridView1.DataKeys[e.RowIndex].Values[0].ToString() + "'";
cnx.Open();
cmd.ExecuteNonQuery();
cnx.Close();
FillVendorGrid();
}
}
|
|
|
|
|
Ok, so it looks prettier. But not quite there.
What the code block does is preserve formatting. So the indentation that VS enforces show up. For example:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FillVendorGrid();
}
}
and
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FillVendorGrid();
}
}
are posted with the same info - see the difference?
When you add the code block, paste it from VS, not from your earlier message!
Plus, remember that bit about asking a question?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
dear griff i m sorry but dear plz help me if u have any idea
|
|
|
|
|
No need to call me dear - you don't know me that well.
What is the problem? Code - ok. What is not happening? Or happening that shouldn't?
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
ok sorry sir i remove this error but i face another error when i click delete in the gridview
cmd.CommandText = "DELETE FROM Coupon_Info WHERE RecievingDate='" + GridView1.DataKeys[e.RowIndex].Values[0].ToString() + "'";
it highlight this code nd error is
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
|
|
|
|
|
Change your routine to:
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
cmd.Connection = cnx;
cmd.CommandText = "DELETE FROM Coupon_Info WHERE RecievingDate='";
DataKeyArray dk = GridView1.DataKeys;
IOrderedDictionary iod = dk[e.RowIndex].Values;
cmd.CommandText += iod[0].ToString();
cmd.CommandText += "'";
cnx.Open();
cmd.ExecuteNonQuery();
cnx.Close();
FillVendorGrid();
}
Place a breakpoint at the definition of dk, and single step. That should tell you which index is in error.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
|
Only code.. whats the question?
Thanks,
Arindam D Tewary
|
|
|
|
|
What do I do with this?
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Stop dumping this cr@p
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
|
creend wrote: It's my mistake,Sorry!
you did the same mistake three times.....
|
|
|
|
|
|
See above
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Maite, no body has time here to guess a question out of the code?
You need to tell your problem,s o that some one may can help you.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
|
|
Nice code dump - I'm sure we don't need the designer contents too. Try using <pre></pre> tags around your code.
Now what is the problem/question as you seem to have forgotten that bit?!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
|
Hi Experts,
I want to add shortcut in places bar in Open File Dialog Box.I know we can archive it using Regedit,But like to know how can i do it using Windows API (Hooking).
Urgently.....
|
|
|
|