|
Hi ,
I have a small requirement, which I am unable to complete.
I am having a gridview on the form, and the data is bined to the grid using ObjectDatasource that is inturn binding from a TableAdapter in the dataset.
I have all select,insert,update and delete commands specified.
When i click on update or insert or delete it is just working fine as it is intended to.
It is directly updating/inserting/deleting in the database.
My requirement now is it should not update directly in the database instead it should update the database on click of a "Save" button at the bottom of the page.
All the changes he had made till now in the grid should directly updated in the database at one shot.
I dont want to store in either in a variable or in a session. Because of the memory constraint.
Is there any efficient way. I have tried googling all around and one link I found which is similar is
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/cac3ab15-9236-4e6a-9ec1-f3cd73c91641
The explanation is very clear but I need it with an example.
Thanks in advance.
|
|
|
|
|
The Guy is Talking about ado.net. If you use Wizards to do your Database work you will encounter problems like limitations. Now in your case you dont want to update the grid automatically as the user leaves the field but on a Button click when you will have your own custom code. As the guy explained in the msdn post you have read. it can be done. i have written an article before, but it was for a windows application and the aproach is the same check it out
Coding an N-Tier Application in C# Without Any Wizard: Part II[^]
Hope this Helps
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Thank you, For ur reply.
The post was very nice, Once upon a time I also such BLL and Valueobject classes.
But as i started using Dataset, it seems to be it is providing me all the stuff.
Let me explain My requirement briefly.
I have a grdiview , I will update or delete or insert rows(using commandbuttons) in the gridview. But it should not be affected directly in database untill i click on save button(which is outside the grid).
Conditions to achieve this are:
1. Should not use variables or sessions
2. Must use object datasource and Dataset located in APP_CODE folder
I hope there must be easiest way. as part of this reasearch some where else I found xmlserialzation would help working on it. I will let you know once it is done.
|
|
|
|
|
I think this is simple
as you said all command objects have the values, meaning the insert, update, and delete. ok now what you can do remove the command statements from the Sqldatasource control and put them in a Button as you want outside the the Gridview and do your update this way
SqlDataSource1.Update()
or
SqlDataSource1.Delete();
Am not a fan of XML
This will help.
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi Friends,
i want to integrate third party forum in our project. any one can suggest the same.
i also try to search in google.
Regards
Keyur Satyadev
|
|
|
|
|
|
Dont ask abstract question.Be specific when asking the question with proper detail
Cheers!!
Brij
|
|
|
|
|
Hi Brij,
Sorry i can explain in english only. The question is not abstract atleast for me.
And i want to integrate third party forum in my asp.net 3.5 project.
I can't provide more detail. Hope you know what is forum or third party software?
Still if any concern then pl let me know.
Regards
Keyur Satyadev
|
|
|
|
|
keyur satyadev wrote: The question is not abstract atleast for me.
And i want to integrate third party forum in my asp.net 3.5 project.
I can't provide more detail. Hope you know what is forum or third party software?
Hi Keyur,
Here every one wants to helps you. If some one think that if you can provide some more details that he can answered better, then you should. In the end it would help you.
So, please be polite.
Thanks !!
cheers,
Abhijit
CodeProject MVP
Web Site:abhijitjana.net
When you ask a question, remember to click "Good Answer", If the Answer is helps you.
|
|
|
|
|
Hi Abhijit,
you are absolute right. but in our code project site some people
always make marking (comment) on other question). that's why we
have no option to right this. as a developer i know if we are clear
more then we can give our better to other.
Sorry, but my intention is not to use wrong words.
Regards
Keyur Satyadev
|
|
|
|
|
No need to sorry man. I was just saying only because if you give you some more details, may be that can help you only. Finally our moto is, we need the solution of a problem.
Thanks mate
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
keyur satyadev wrote: Sorry i can explain in english only. The question is not abstract atleast for me.
I think you didn't get me.what third party forum you are talking about.Every third party forum/tool or anything has diffrent way to integrate.
keyur satyadev wrote: I can't provide more detail. Hope you know what is forum or third party software?
If you are saying like this means,you didn't do the proper homework for your requirement.First clear your requiement,get the details, design it,look for the third party controls that you require on internet and try to develop the application.nad if face some problem,post your question here.
Cheers!!
Brij
|
|
|
|
|
Hi,
Whatever detail i could give, i have given. I have done homework for my requirement. I want third party control for forum thorugh which i can inegrate it in my application. The application has been already developed and i am not getting the third party forum control for which i am looking for. Hope whatever details i provided to you would be enough.
It would be great if you can give answer for this.
Pl answer if you have solution for this. We value our time.
|
|
|
|
|
hey im using mscharts im unable to show multiple columns value or the value of one row selected from database one either axis of web chart(either on X aixs or on y axis) .. plz help me buddies really needed urgently..
here is my row:
title|2006|2007|2008|2009|
bmat |1.70|8.69|4.67|23.8|
i have installed .net framework 3.5 sp1
and vs addons , mscharts...
plz any guidence will be appreciated
modified on Thursday, July 23, 2009 12:00 PM
|
|
|
|
|
Please read the forum guidelines.
|
|
|
|
|
I have two applications configured in IIS. I need to Pass some values from one application to other using HttpContext object.
I have tried out using
FormsAuthentication.SetAuthCookie("Hello", false)
which sets one value in the Httpcontext object which i m retrieving from other application through
HttpContext.Current.User.Identity.Name property.
Upto this all works fine but i need to pass more user data using Httpcontext object and retrive it in other application.
How can i do that?
Is it possible to pass more user data Using HttpConext Object or not....
Please help me out
|
|
|
|
|
Actually, what is happening is simply a cookie being set on the client. SetAuthCookie establishes the user authentication cookie, which allows HttpContext.Current.User to be available.
If you want to application #2 to read application #1 data, you could have app#1 set a cookie that app#2 can then read.
|
|
|
|
|
I need to fetch the list of open windows, which all currently open in client machine. Though i did some finding and code is working in local web server, however this does not works if this hosted in remote machine.
I am trying to access the link (application hosted in remote server) in my local machine, and while doing so this does not return me list for currently opened windows.
What should i do to make this work? Here is the code sample i am using:-
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Runtime.InteropServices;
using System.Text;
namespace SIGN
{
public partial class EnumDesktopWindows : System.Web.UI.Page
{
const int MAXTITLE = 255;
private static ArrayList mTitlesList;
private delegate bool EnumDelegate(IntPtr hWnd, int lParam);
[DllImport("user32.dll", EntryPoint = "EnumDesktopWindows",
ExactSpelling = false, CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool _EnumDesktopWindows(IntPtr hDesktop,
EnumDelegate lpEnumCallbackFunction, IntPtr lParam);
[DllImport("user32.dll", EntryPoint = "GetWindowText",
ExactSpelling = false, CharSet = CharSet.Auto, SetLastError = true)]
private static extern int _GetWindowText(IntPtr hWnd,
StringBuilder lpWindowText, int nMaxCount);
protected void Page_Load(object sender, EventArgs e)
{
string[] desktopWindowsCaptions = GetDesktopWindowsCaptions();
string tmpCaption=string.Empty;
foreach (string caption in desktopWindowsCaptions)
{
tmpCaption = tmpCaption + "@@@" + caption;
}
Response.Write(tmpCaption);
}
private static bool EnumWindowsProc(IntPtr hWnd, int lParam)
{
string title = GetWindowText(hWnd);
mTitlesList.Add(title);
return true;
}
/// <summary>
/// Returns the caption of a windows by given HWND identifier.
/// </summary>
public static string GetWindowText(IntPtr hWnd)
{
StringBuilder title = new StringBuilder(MAXTITLE);
int titleLength = _GetWindowText(hWnd, title, title.Capacity + 1);
title.Length = titleLength;
return title.ToString();
}
/// <summary>
/// Returns the caption of all desktop windows.
/// </summary>
public static string[] GetDesktopWindowsCaptions()
{
mTitlesList = new ArrayList();
EnumDelegate enumfunc = new EnumDelegate(EnumWindowsProc);
IntPtr hDesktop = IntPtr.Zero; // current desktop
bool success = _EnumDesktopWindows(hDesktop, enumfunc, IntPtr.Zero);
if (success)
{
// Copy the result to string array
string[] titles = new string[mTitlesList.Count];
mTitlesList.CopyTo(titles);
return titles;
}
else
{
// Get the last Win32 error code
int errorCode = Marshal.GetLastWin32Error();
string errorMessage = String.Format(
"EnumDesktopWindows failed with code {0}.", errorCode);
throw new Exception(errorMessage);
}
}
}
}
|
|
|
|
|
Ashi777 wrote: I need to fetch the list of open windows, which all currently open in client machine. Though i did some finding and code is working in local web server, however this does not works if this hosted in remote machine.
Yup that will happen because of the Asp.net nature.If you want this in client machine you have only one option that is ActiveX control...
himanshu
|
|
|
|
|
Thanks. Let me do some more digging
|
|
|
|
|
As the code runs on the server it is returning you the open windows on the server, not the client PC. This distinction about where code runs is often overlooked but it is fundamental to understanding ASP.net. As the above post, you'd need ActiveX.
|
|
|
|
|
Thanks. Let me do some more digging.
|
|
|
|
|
hii.....
i wanna update the table column name Description (Having single row) through a multiline textbox.table name is ManageAboutJA.
i hav written following code but still its not updatin..can u help me..plz do help
string str = "UPDATE ManageAboutJA SET Description=@Descrip";
SqlCommand cmd = new SqlCommand(str,conn);
conn.Open();
cmd.Parameters.Add("@Descrip",TextBox2.Text);
cmd.ExecuteNonQuery();
conn.Close();
not even single time i use to get answers from cp why is it so...
wat is it ment for....
thnks...
|
|
|
|
|
Posting again and again will not help you. This is Rude.
pariofshona wrote: not even single time i use to get answers from cp why is it so...
wat is it ment for....
That means you are not trying to follow the answer that other member already gave to you.
cheers,
Abhijit
CodeProject MVP
Web Site:abhijitjana.net
When you ask a question, remember to click "Good Answer", If the Answer is helps you.
|
|
|
|
|
Why cant you try this. Simple when you are using only few parameters.
and dont forget to add where clause while updating, It may update all records in the table.
string str = "UPDATE ManageAboutJA SET Description='" + TextBox2.Text + "'";
SqlCommand cmd = new SqlCommand(str,conn);
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
|
|
|
|