|
Why are you writing a web site to do this ? If you're not, you're in the wrong forum, try the C# forum.
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.
|
|
|
|
|
hi guys
i`m a beginner here plz help me
i have a sqldatasource in my page , and i wana set a query to insert something to it
and i just wana do it in C# coding
would you please give me a sample please ?
|
|
|
|
|
sqldatasource1.InsertCommand="insert into table values(col1,col2) ";<br />
sqldatasource1.Insert();
Hope this helps you.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
thanks
it helps alot
|
|
|
|
|
You are welcome.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
Hi, everyone, I am doing a mobile project based on C# language and I encounter some difficulty regarding old references in an arraylist.
Basically I have an existing object with an arraylist of objects, and wish to make a copy of that. However, everytime I tried to do so, the objects will remain referenced to the old arraylist.
As such, I wish to ask if there is any way to create an independent copy of this object (that contains an arraylist of objects)
Here is my code:
Sector tempAdmin = getAdminSector(SectorList);
Sector admin = new Sector();
admin.CentrePointXCoor = tempAdmin.CentrePointXCoor;
admin.CentrePointYCoor = tempAdmin.CentrePointYCoor;
admin.Name = tempAdmin.Name;
admin.Position = tempAdmin.Position;
admin.SectorHeight = tempAdmin.SectorHeight;
admin.SectorWidth = tempAdmin.SectorWidth;
FixedLocation[] existingItems = (FixedLocation[])tempAdmin.Items.ToArray(typeof(FixedLocation));
FixedLocation f1 = new FixedLocation();
foreach (FixedLocation _loc_ in existingItems)
{
f1.Description = _loc_.Description;
f1.Id = _loc_.Id;
f1.Name = _loc_.Name;
f1.Position = _loc_.Position;
f1.Rank = _loc_.Rank;
f1.XCoor = _loc_.XCoor;
f1.YCoor = _loc_.YCoor;
admin.Items.Add(f1);
f1 = new FixedLocation();
}
I thank anyone who reply to this in advance : )
|
|
|
|
|
yup, am having some sort of the same problem too. Really appreciate some help here. thanks alot! (:
|
|
|
|
|
freeman1989 wrote: Basically I have an existing object with an arraylist of objects, and wish to make a copy of that. However, everytime I tried to do so, the objects will remain referenced to the old arraylist.
You need a deep clone. Easy method would be to iterate the ArrayList contents on a loop and create new objects.
BTW, do you have a good reason to use ArrayList ? I'd suggest to use typed collection like List<T> .
|
|
|
|
|
Hi N a v a n e e t h, thank you for your reply. I had attempted to use the deep clone method. However it does not seem to be working via the clone method. As my variables in the arraylist still get replaced upon calling another method which perform some manipulation to the arraylist in object
As i'm rather new to this, I'm afraid that I might get it wrong hence it is not working properly.
Below is a sample a sample for the Clone() which I'd wrote.
public Sector(string name, Int32 sectorWidth, Int32 sectorHeight, Int32 centrePointXCoor, Int32 centrePointYCoor, Int32 position)
{
this.name = name;
this.sectorWidth = sectorWidth;
this.sectorHeight = sectorHeight;
this.centrePointXCoor = centrePointXCoor;
this.centrePointYCoor = centrePointYCoor;
this.position = position;
items = new ArrayList();
}
public object Clone()
{
Sector sec = new Sector();
sec.items = (ArrayList)items.Clone();
return sec;
}
Is is possible if you could provide me some examples? thank a lot in advanced! (:
|
|
|
|
|
Dear All,
I have put an Ajax update panel in my web page. It was supposed to post-back only right side of the page. However the page inside requires page-preinit event in order to create dynamic controls(link buttons). Now the whole page is loaded. Does pre-init event require whole page to be loaded?
Thanks.
|
|
|
|
|
|
Thanks for the answer.
Well As far as I understand it should not be problem as long as the controls to be updated should be placed within Ajax-update panel. I checked them all necessary controls to be refreshed are placed in the update panel. But whole page is refreshed anyway.
.Net makes me feel that I am idiot. Each step brings another problem on the table. Did I really learn that I doubt now.
|
|
|
|
|
Ersan Ercek wrote: But whole page is refreshed anyway.
You are using Visual Studio 2005 or 2008 ? if 2005 then what kind of Web Site you are selecting Normal or Ajax Enabled web Site ?
|
|
|
|
|
|
hi all,
i don't know whether this is right forum or not...
i just want to know when the .net3.5 (WCF,WPF,..), ajax are released.. release dates
thanks alot in advance
|
|
|
|
|
suni_dotnet wrote: i just want to know when the .net3.5 (WCF,WPF,..), ajax are released.. release dates
Please Check Here[^]
And Check this
Check Here[^]
|
|
|
|
|
I've got web app that should create files and folders in its ~/somefolder at the root. While debugging in VS it works fine but when I linked the application with IIS 7.0 I've got Exceptions at the attempts to create a file or folder due to access rights.
Чесноков
|
|
|
|
|
I think you need to provide ASP.NET account write access on that path.
|
|
|
|
|
I have two tables both containing 3 columns each. In first table there were 3 columns(c1,c2,c3) and in second table there were 3 columns(b1, b2, b3). Now i have to display in gridview. But i want display only 2 columns i.e., c1 from first table and b2 from second column. How can i do that?
|
|
|
|
|
It should be simple, one possible solution could be write some wrapper class with two fields having compatible types to corrosponding database columns. For example
public class MyWraper
{
private string _column1
public string Column1
{
get{return _column1;}
set{_column1 = value}
}
private string _column2
public string Column2
{
get{return _column2;}
set{_column2 = value}
}
}
Now write some query that return data from both tables. Now depending upon those columns returned by query create for each record create a new wrapper object, populate its data from respective column values and finally add it some list. Now finally bind your grid to that list.
List<MyWraper> myList = new List<MyWraper>;
while(dataReader.Read())
{
MyWraper w = new MyWraper();
w.Column1 = dataReader["C1"].ToString();
w.Column2 = dataReader["C2"].ToString();
myList.Add(w);
}
gridView1.DataSource = myList;
gridView1.DataBind();
|
|
|
|
|
I am tried this. But i am not able to use the list it is giving error. Please help me. Which is the namespace i have to add so that i can use list.
|
|
|
|
|
hello every one
I work a special site for Real Estate
It is the services provided the service of the search for real estate and certain specifications such as the type of property to be either Villa or apartment number of floors neighborhood ....
So I need a search within the databases
How do I write a research and search data entered by the user who used a graphical user interface containing the by dropdwonlist and check box
plz help me
|
|
|
|
|
First of all create your UI and place desired control for example dropdown for selecting property type etc. In order to implement search function you would need to build query on runtime depending upon values selected by user. For example let say there is a table having 4 columns id,name,gender,age and you need to build some page where user can filter users upon age and gender.
Suppose you placed a dropdown box with two values Male,Female and a text box to enter the age, a button with caption filter to trigger filter and finally a grid view for showing filtered data. Now write a function that takes two parameters gender and age and returns matched customer records for example
public DataTable FilterUsers(string gender,int age)
{
string selectQuery = "SELECT * FROM c_Users WHERE Gender ='{0}' AND Age={1} ";
selectQuery = string.Format(selectQuery,gender,age);
//Code here to execute query
//finally return the returned data table with resutls
}
|
|
|
|
|
Hi all,
I want to Store All Textbox id's of Current Page into an Array..
Let me know this..
|
|
|
|
|
Why are you doing that?whats your requirement?
|
|
|
|