|
Thanks, works a treat now
|
|
|
|
|
hi
i am use VC# 2005 and i want to connect to sqlserver 2000 from client to server,when i want to add datasource to my app and enter server name to
specific textbox and click Test connection the following error shown me :
Login failed for user 'VAZIRI-B8765F7F\Guest'.
I use Trusted Connection for connect to server
How to solve my problem ?
very thanks
|
|
|
|
|
Hi,
Are you sure that the credentials you supplied are correct ? (User name and password).
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
Hi
When you use trusted connection it means that you are connectiong to sql server using windows authentication which means that you are connectiong using the user name that you have logged on with.(In this case Guest user)
therefore you should define the guest user in your SQL Server.
If you like you can use user and password keywords in your connection string to use Sql authentication instead of a trusted connection then you can use a sql server user (for example sa) to connect to Sql Server
Regards
|
|
|
|
|
Plz compile these programs for me & do tell me where r the errors.
WAP to take 2 dates using objects(day,month,year)& display both dates,their comparison also that which one is greater(take the dates with the help of three parameter constructors)
class demo
{
DateTime dt1=new DateTime(Monday,November 06,2006)
DateTime dt2=new DateTime(Wednesday,November 08,2006)
if(DateTime.compare(dt1,dt2)<0)
{
System.Console.WriteLine("Second date is larger than the first");
}
else if(DateTime.compare(dt1,dt2)==0)
{
System.Console.WriteLine("Second date is same as the first date");
}
else
{
System.Console.WriteLine("Second date is smaller than the first date");
}
}
-------------------------
class demo
{
private DateTime getDate(int day, int month, int year)
{
return new DateTime(year, month, day);
}
private void compareDates(DateTime a, DateTime b)
{
if (a > b)
Console.WriteLine(a.ToShortDateString() + " > " + b.ToShortDateString());
else if (a == b)
Console.WriteLine(a.ToShortDateString() + " = " + b.ToShortDateString());
else
Console.WriteLine(a.ToShortDateString() + " < " + b.ToShortDateString());
}
}
---------------------------
WAP that counts the no. of occurence of particular character in a line of text.
class demo
{
private int Occurance(string Input, string Find)
{
System.Text.RegularExpressions.Regex rx =
new System.Text.RegularExpressions.Regex(Find);
// to display them do this
System.Text.RegularExpressions.Match mt = rx.Match(Input);
while (mt.Success)
{
Console.WriteLine("Found >>" + Find + "<< at position " + mt.Index.ToString());
mt = mt.NextMatch();
}
// end display
return rx.Matches(Input).Count;
}
}
|
|
|
|
|
What?
Why don't you compile them yourself? You can use Visual Studio Express or the .NET Framework SDK to compile from command prompt. You can then easily check the errors and fix them.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I don't have compiler or Visual Studio at home.I have also tried to download SDK from microsoft but it is giving errors.
sorry for the inconvenience.
-- modified at 12:51 Saturday 11th November, 2006
|
|
|
|
|
It's pretty clear why this doesnt compile. Only variables, properties and methods can be placed inside a class. Everything else should be inside methods.
class Class1
{
public static void Main(String[] args)
{
}
}
WM.
What about weapons of mass-construction?
|
|
|
|
|
I didn't even try to compile the mess, I just looked at it. That's why the error messages are more to the point than the ones you would get from the compiler:
DateTime dt1=new DateTime(Monday,November 06,2006)
Variable 'Monday' is not defined.
'November 06' is not a valid expression.
There is no constructor for the DateTime structure that takes those arguments.
DateTime dt2=new DateTime(Wednesday,November 08,2006)
Variable 'Wednesday' is not defined.
'November 08' is not a valid expression.
There is no constructor for the DateTime structure that takes those arguments.
if(DateTime.compare(dt1,dt2)<0)
The operator is "Compare", not "compare".
Friend4u wrote: else if(DateTime.compare(dt1,dt2)==0)
The method is named 'Compare', not 'compare'.
---
b { font-weight: normal; }
|
|
|
|
|
Is there a way to specify a type contraint that operator== is supported?
or any way to deal with that?
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify! || Fold With Us! || sighist
|
|
|
|
|
Off the top of my head, I can only think of:
where T : System.IComparable<T>
Geor
|
|
|
|
|
It was suposed to work for value types, too
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify! || Fold With Us! || sighist
|
|
|
|
|
Have a look at the IEquatable interface.
---
b { font-weight: normal; }
|
|
|
|
|
peterchen, are you looking to just compare 2 reference types? If so,
bool AreEqual<T>(T first, T second)
where T : class
{
return first == second;
}
|
|
|
|
|
I wanted it to work for both reference nad value types, and use overloaded comparison operators if any - but that doesn't seem possible in C#.
I've replaced the template type with object, and use IComparable if implemented, otherwise I fall back to comparing the references.
thank you.
Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers! We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP Linkify!|Fold With Us!
|
|
|
|
|
You have to use the IEquatable interface.
More information on the "operator in generics" problem: www.codeproject.com/csharp/genericnumerics.asp[^]
Quote: The solution uses the fact that constraining type parameters using interfaces is not the same as casting to interfaces. Calling a method using an interface has the overhead of dynamic method dispatch, but calling a method on a type parameter that is constrained by an interface has no such overhead.
|
|
|
|
|
Dear All,
Let me know about the basics of windows Remoting & COM programming.Regards.
Raihan Masud
|
|
|
|
|
You might want to take a look here.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
i have a webpage with asp button. in server side, i wrote some code for its button click event to delete the page data.
but in client side i want user to confirm the deletion action. so i write this javascript code:
{if(confirm("do want to delete data...."))}
i don't know what to do to prevent page postback for false condition.
what should i do...
Thanks Rastgar
|
|
|
|
|
{if(!confirm("do want to delete data....")) return;
else do();}
|
|
|
|
|
i now 'if' parts and what 'return' does.
the thing that i don't know is how to stop my page from postback. but now i found it. to know that refer to my reply to guffa
Thanks Rastgar
|
|
|
|
|
Return a boolean in the click event of the button:
onclick="return confirm('Delete?');"
If the event returns false, the button click is stopped.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks alot.
but your sample code doesn't work or atleast i couldn't understand you and apply your method.
but i found another method in other forum. here it is...
{
if(confirm('do you want to delete?') return true;
if(document.all && window.event) event.returnValue = false;
return false;
}
it works so much better and do what exactly i wanted.
Thanks Rastgar
|
|
|
|
|
The code that I wrote does work, but the backwards way that this forum uses for "security" changed it.
Remove the * in the code:
o*nclick="return confirm('Delete?');"
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I want to make a for statement that displays the divide by sums like this:
1 / 1 =
2 / 1 =
3 / 1 =
4......
2 / 2 =
4 / 2 =
6 / 2 =
8......
Up until 5. How can i make that in a for statement?
Thanks in advance!
|
|
|
|