|
what do u mean by stop the execution of the code.
You just have to write the code in the IF block,,, if the string is not empty perform what ever you want else nothing...
e.g.
if(!String.Equals(String.Empty, Openfile())
{
///DO WHAT U WANT DO
}
else
nothing will happen....
Is that fine?
Thanks & Regards,
Pramod
"Everyone is a genius at least once a year"
|
|
|
|
|
yes, read previous post and forgive my brainfart!
Jude
|
|
|
|
|
Hi All,
Can anyone give me refference of how to send sms messages through a cell phone???
Thanx.
|
|
|
|
|
|
Use the SMS client installed on the phone.
led mike
|
|
|
|
|
Check out http://www.smscountry.com/[^]
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Good Evening All
i have Restored a SQl 2005 Database into my machine, and that Database carried the Stored Procedure. now i have an Application that depends on those Stored Procedure. In the Business Intelligance ,i can see the Stored Procedures and i have recompile the Sp's thinking that it might Solve the Problem, So my Application complains that the Stored Procedure could not Found, but in my DB its there. And Secondly Second it will tell me that the Connection object has not been initialized, but i know that i deed, and i can prove it
con = new SqlConnection(strcon);
con has been Declared Globaly, i have the Same Application running at my work place and this SQl am having a Problem with , its my hom machine.
And here is how i use my Procedure ion C#
<br />
cmdinserted = new SqlCommand();<br />
<br />
cmdinserted.CommandText = "prmInsert_Property";<br />
<br />
cmdinserted.CommandTimeout = 0;<br />
<br />
cmdinserted.CommandType = CommandType.StoredProcedure;<br />
<br />
cmdinserted.Connection = con;
as we can see everything its done and Perfect, does the Problem lies on the resoted DB, what should be taken into consideration when restoring a Db that has SP's
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Vuyiswa wrote: and i can prove it
Showing code doesn't prove that what yuo have is correct.
Vuyiswa wrote: everything its done and Perfect
Obviously it isn't perfect, or you wouldn't be having problems.
Check you connection string, varify it is correct, don't assume it is.
only two letters away from being an asset
|
|
|
|
|
my connection string is poiting to the correct Server and DB.
and the connection object is declared and initialized.
thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
First step - stop making excuses, read the error messages and work out why it is that you're wrong in thinking that everything is perfect.
If it works on one machine and not another, I'd say the problem is the connection string.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
ok, Thanks, i will look at it when i get home tonight
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Hi all,
I would like to know isit possible to add a new rule/logic like "If X>Y then.. " into application during "runtime" environment. I mean that i can edit/add the code during "runtime" environment without open the source code in C#.
Any tips (in any programing language- vb,vb.net,c#)or related sources are welcome.
Thanks in advance
regards
lswang
|
|
|
|
|
|
|
|
You can do this. The technique that you are talking about is called a Rules Engine. There's a very good one available for .NET called NxBre.
|
|
|
|
|
Hi Pete O'Hanlon,
Is any example source/tutorial on NxBre. Please redirect me to the right way.
regards
lswang
|
|
|
|
|
|
Hi, i am trying to pass an array of struct in c# but I keep getting Inconsistent accessibility errors. I am including the code below:
________________________________________________________________________________________________________________
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace friendstruct
{
class Program
{
class friendType
{
public string name;
public string age;
}
public static void load_data(friendType[]friends)
{
Console.WriteLine("Hello");
FileStream file = new FileStream("Marilia.txt", FileMode.Open, FileAccess.Read);
StreamReader reader = new StreamReader(file);
load_data();
for (int i = 0; i<3; i++)
{
name = reader.ReadLine();
str_age = reader.ReadLine();
age = Convert.ToInt16(str_age);
friends[i].name = name;
friends[i].age = str_age;
}
reader.Close();
}
public static void Main(string[] args)
{
int age;
string str_age;
string name;
friendType[] friends = new friendType[10];
load the data from the data file
load_data(friends);
//print the data file out
for (int i = 0; i < 3; i++)
Console.WriteLine("{0} {1} ", friends[i].name, friends[i].age);
}
}
}
_________________________________________________________________________________________________________________
|
|
|
|
|
Jerry Graham,
If you change:
class friendType
{
public string name;
public string age;
}
To:
public class friendType
{
public string name;
public string age;
}
I think it should work. Basically, the error is because one class is set to public and the other isnt.
Regards,
Gareth.
|
|
|
|
|
Hi,
That worked. thanks a lot. I have no syntax errors, however the problem crashes in the load_data() function when I attempt to insert a value into the array.
friends[i].name = name;
causes the following error:
Object reference not set to an instance of an object
|
|
|
|
|
Jerry Graham,
In your code, you only create an array, you dont create any instances. So, you need to do:
friendType myFriend = new friendType();
myFriend.name = "bob";
friends[i] = myFriend;
On a side note, i'd personnly change your array to a generic list. eg:
List-friendType- friendArray = new List-friendType-;
(Change the "-" to "<" and ">", it wouldnt let me add them, guess CP doesnt allow for naughty HTML to be inserted)
This is because as you create the array, you set its size to be 10, now if you always populate that array with 10 friends, then its fine. But what if you want 11, your array doesn't handle that or if you only have 9 friends, then you have a null item. Just a tip.
Also, its a good idea to follow the standard naming convention.
http://msdn2.microsoft.com/en-us/library/ms229045.aspx[^]
Regards,
Gareth.
modified on Tuesday, March 25, 2008 3:17 PM
|
|
|
|
|
I guess what is a bit puzzling to me is that this same code works if I use a single main function. it is only after I extract the reading of the data file into the load_data() function that these problems occur.
|
|
|
|
|
Your suggestion worked. However could you tell me why this works?
--------------------------------------------------------------------------------------------------------------------using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace friendstruct
{
class Program
{
struct friendType
{
public string name;
public string age;
}
public static void Main(string[] args)
{
int age;
string str_age;
string name;
friendType[] friends = new friendType[10];
//load the data from the data file
FileStream file = new FileStream("Marilia.txt", FileMode.Open, FileAccess.Read);
StreamReader reader = new StreamReader(file);
for (int i = 0; i<3; i++)
{
name = reader.ReadLine();
str_age = reader.ReadLine();
age = Convert.ToInt16(str_age);
friends[i].name = name;
friends[i].age = str_age;
}
reader.Close();
//print the data file out
for (int i = 0; i < 3; i++)
Console.WriteLine("{0} {1} ", friends[i].name, friends[i].age);
}
}
}
-------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
When you create an array of structures, the array contains the instances of the structure.
When you create an array of objects, the array contains references to the objects. All references are null when you create the array, so you have to create the instances and assign the references to the array items.
Structures are tricky to use, especially if they are mutable, as your structure is. Unless you have a really good reason to use a structure, just keep to using classes.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|