|
Hi Rahul,
Can you please give me an example: Based on my code??
|
|
|
|
|
Why would you want to define either of those methods inside another method, rather than just call the method in the usual way?
Do you have any experience in programming, or is this one of your first attempts? If it is I strongly advise you pick up a book on C# (or whatever chosen language) and work through the basics!
|
|
|
|
|
The solution is to learn the basics about programming and the C# syntax. The simple answer is:<blockqoute>You can't define methods nested inside other methods like that.You define all of your methods at the same level and then call them from one another:
protected void butUpload_Click(object sender, EventArgs e)
{
BindData();
string connectionString = GetConnectionString();
}
private void BindData()
{
DataSet dsLoginSourceGrid = GetLoginDataSet();
GridView1.DataSource = dsLoginSourceGrid.Tables[0].DefaultView;
GridView1.DataBind();
}
private string GetConnectionString()
{
string strConnectionString = ConfigurationManager.ConnectionStrings["constr"].ToString();
return strConnectionString;
}
Also, it helps if you put your code samples in <pre> tags so they are readable.
|
|
|
|
|
hi all
i have an xml
i am able to change into data table
and insert into database also...
StringReader xmlsr3 = new StringReader(region);
dset3.ReadXml(xmlsr3, XmlReadMode.IgnoreSchema);
OleDbDataAdapter da3 = new OleDbDataAdapter("select * from drregion", m_Conn);
OleDbCommandBuilder cb3 = new OleDbCommandBuilder(da3);
da3.Update(dtab3); dtab3 = dset3.Tables[0];
like this it gets updated
now the problem is when xml string has a keywords (of databases)
while updating into database that is in the last statement
there is an error saying insert into syntax error
i need to change the
ex: keyfield-desc
to [desc] (i could nt do it in xml ) there was another error if i do that
how can i do this
or is there any other way....
|
|
|
|
|
How to test wheather the content is null or not?
byte[] filecontent
if(filecontent==null)
is it right?
pls give ASAP
|
|
|
|
|
Hello,
jayarajmrj wrote: How to test wheather the content is null or not?
byte[] filecontent
if(filecontent==null)
is it right?
If you mean, that there was never done an instanciation:
filecontent = new byte[x];
The answere is, Yes!
If you mean that after the instanciation is done, there was never an assignment to the bytes:
filecontent[0] = ???;
.
.
.
filecontent[x] = ???;
The answere is, No!
jayarajmrj wrote: pls give ASAP
Please, please, please, don't do that again.
It is very rude and will make people angry!
All the best,
Martin
|
|
|
|
|
Please help out in following code snippet:
For the first time it gives prompt while XmlSchema.Read(). Second time schema_collection_object is not null and soes not enter into the below code snippet and works perfectly.
Please help............
XmlSchemaCollection schema_collection_object;
if (schema_collection_object==null)
{
schema_collection_object=new XmlSchemaCollection();
XmlTextReader xmlFile=new XmlTextReader(path);
//path contains the path of the .xsd file
m_ifschema=XmlSchema.Read(xmlFile,new ValidationEventHandler(ValidationCallBack));
//*******error is genarated in the above statement
m_ifSchema.Compile(newValidationEventHandler(ValidationCallBack));
schema_collection_object.Add(m_ifSchema);
}
Hemendra Vyas
|
|
|
|
|
string strPath = @"D:\XML Tutorial(Basics).doc";
string strFileName = strPath.Substring(strPath.LastIndexOf("\\") + 1);
Here it works fine to separate the filename.
Apart from "LastIndexOf", Is there any method to split the filename from the path.
pls give the solution ASAP
|
|
|
|
|
Hi,
Use the following:
string filename=System.IO.Path.GetFileName("YourFilePath");
Naresh Patel
|
|
|
|
|
Hello,
to split a string, you would use the:
String.Split[^] method.
Dealing with filename and pathes you could use the fancy features of System.IO.Path[^] namespace!
In your case, the GetFileName[^] method will do what you need.
string strPath = @"D:\XML Tutorial(Basics).doc";
string strFileName = System.IO.Path.GetFileName(strPath ); /will return: 'XML Tutorial(Basics).doc'
Hope it helps!
All the best,
Martin
|
|
|
|
|
you can use System.IO.Path Class to do that
like
<br />
string path=@"C:\my Pics\test.bmp";<br />
string fileName=System.IO.Path.GetFileName(path);
good luck
|
|
|
|
|
Hi,
I am C# programer, I have to test one server side application which is written in VB by making a client application in C#, that how much load it can bear, i would like if anybody provide me code for testing this senario.
I have to load as much as 100 user at same time login (instantly).
Thanks in advanced.
Amit
|
|
|
|
|
HI Amit,
Well u can test out your application by using LoadRunner application load test tool. Its a classic tool to generate an environment which will help u to carry out stress test of your application. Please download the 10 Days trial version from the site for "Mercury Loadrunner". U can even search out for simpler tools which are available on net for free.
Thanks
Amit kadam
Amit Kadam
|
|
|
|
|
is there any method to delete an object in c# explicitly or i have to set obeject to null and then wait for GC to delete it.v
skhurram
|
|
|
|
|
Use dispose method
obj.Dispose();
Thanks
|
|
|
|
|
There really is no 'Explicit' deletion of managed objects in .net like there are in other languages such as c++. You will have to always wait for th GC to do it stuff. obj.Dispose is just a clean up method really designed for releasing unmanged resources like handles.
The Dispose Pattern discusses disposing of objects
Keep your eyes open, you might spot alternatives.
|
|
|
|
|
There is no way to "delete" an object in .NET like you do in C or C++. The closest you can get is to call the Dispose method if it's available (or the appropriate equivalent since some classes have a Close method that actualy does the same work as Dispose ) and wait for the GC to delete it.
Check out this article Implementing IDisposable and the Dispose Pattern Properly[^] for more details on how to use Disopse .
|
|
|
|
|
Can anybody give me some idea on displaying a form from its right most position to left most.Just as reverse to its normal display.Here i want to use a timer while displaying the form.
|
|
|
|
|
you just go to the properties of the form and set the localize = true with the location 0,0 .
Assaf
|
|
|
|
|
Hi assaf,
Actually i didn't explained my question clearly.I have display a form from a specified pt lets say(x1+width,y1) to(x1,y1).
|
|
|
|
|
write the code in ur form
this.location = new point(x1+width,y1)
Is it solve ur issue?
Thanks
|
|
|
|
|
It is not correct solution to my issue.Otherwise is it possible to display a form in reverse co-ordinates interms of its width? Lets say it starting location is (x1,y1) and its end pt should be (x1-width,y1-height).
|
|
|
|
|
I am not clear abt ur issue.I think u want to reverse the form.If u put a control at position (0,10) when u reverse it should display at (width,10). Is it?
Can I know why u want to reverse the form?I think it is not possible..not sure.
Thanks
|
|
|
|
|
I will give a brief about my requirement i have to expand a child window form to the left or right side of the parent window depending on the parent window location when i click on a button. And there should be more button on the child form when clicked ,then that window should be collapsed.
Thanks for your assistance.
|
|
|
|
|
Now much clear I think.You can do this from your parent form.In parent (let assume form1)form's button (btnForm) click event call the form2
btnForm_Click()
**********************
form2 f = new form2()
f.size = new Size(100, 100); //set the size of ur form2
f.location= new point(this.Location.X + this.Width -100 , this.Location.Y ); // here 100 is width of form2
f.Show();
hope this will work for u ...
if not pls let me know.Thanks
-- modified at 4:51 Friday 17th August, 2007
|
|
|
|