|
Not so much in retrieving all records but to disable the logon from accessing certain tables. The program will have menu options to get different data from different tables and certain logons are not to have access to this information.
Thank you for your reply.
|
|
|
|
|
I have tryed in Sql Server 2005 Express version.
it have this feature.
see details here
-- modified at 22:37 Thursday 24th August, 2006
|
|
|
|
|
If I remember right you can read the system tables to do that but the best way would be to use the internall parameters (@@something). You should write your own function in SQL to do either. This is a question for an SQL forum because I am sure someone did this before and it is going to vary depending on SQL version.
|
|
|
|
|
Hi all!!
How do I convert the following to 1 line of code??
int intBottleQty = i * 6;
String strBottleQty = intBottleQty.ToString();
I tried String strBottleQty = i * 6; but it wouldn't convert. I always thought that integers can get converted to strings??
I hope someone can help me.
Regards,
ma se
|
|
|
|
|
try
string strBottleQty = (i * 6).ToString();
|
|
|
|
|
String strBottleQty = String.Format("{0}", i * 6)
|
|
|
|
|
try like this
int intBottleQty = i * 6;
String strBottleQty =Convert.ToString(intBottleQty);
i hope this will help u...
ayyp
|
|
|
|
|
ma se wrote: I always thought that integers can get converted to strings?
Yes, they can, but not automatically. You have to tell the compiler that you actually are wanting to do the conversion, and not just trying to assign an integer to a string variable by mistake.
Here are some of the ways that it can be done:
string bottleQuantity = (i * 6).ToString();<br />
string bottleQuantity = Convert.ToString(i * 6);<br />
string bottleQuantity = (i * 6).ToString(CultureInfo.InvariantCulture);<br />
string bottleQuantity = (i * 6).ToString(CultureInfo.CurrentCulture);<br />
string bottleQuantity = (i * 6).ToString(new CultureInfo("en-GB"));<br />
string bottleQuantity = (i * 6).ToString("0");<br />
string bottleQuantity = string.Format("{0}", i * 6);<br />
string bottleQuantity = string.Format("{0:0}", i * 6);<br />
string bottleQuantity = (i * 6).ToString("0", CultureInfo.InvariantCulture);<br />
string bottleQuantity = string.Format(CultureInfo.InvariantCulture, "{0}", i * 6);
---
b { font-weight: normal; }
|
|
|
|
|
Thanks, but if i are numbers ranging from 1 - 20, how can they be different in all the scenarios you have given me, I mean 1 is 1 and 2 is 2, etc.
|
|
|
|
|
What do you mean? Why would they be different?
---
b { font-weight: normal; }
|
|
|
|
|
What I am trying to ask is why is there like 50 different ways to format an integer?? No matter how you format an integer, lets say for example the number 6, you won't get it to display differently than to a 6.
|
|
|
|
|
Actually, you can format an integer in may ways. For example the number 1234567 can be formatted as:
1234567
00001234567
1,234,567
1234
1,234
000001234
1 2 3 4 5 6 7
0-0-0-0-0-0-1-2-3-4-5-6-7
0000 0123 4567
1
000001
...and so on.
Mostly, though, the different way of formatting values are used with data types like dates and floating point numbers.
---
b { font-weight: normal; }
|
|
|
|
|
Hey..
I see what you mean. But thanks for the effort and time taken to answer my questions.
|
|
|
|
|
Hi.i did a project a that records a transactions that customer make daily something like Bank,so i want to display only transactions that were made by a specific customer using his account number on the datagrid.the problem is it doesn't display the record i that requested it to display only
so i did something like this.
public bool DisplayTrans(string CBarcode2)
{
try
{
conn1= new SqlConnection(ConString);
cmdDisplay1= new SqlCommand();
daDisplay = new SqlDataAdapter();
dsDisplay = new DataSet();
cmdDisplay1.Connection = conn1;
daDisplay.SelectCommand = cmdDisplay1;
cmdDisplay1.CommandText = "SELECT CustomerName,ProductName,Price,EventName,BoughtDate,BoughtTime FROM Transactions WHERE Barcode2 =@Barcode2 ";
SqlParameter Bar = new SqlParameter();
Bar.ParameterName = "@Barcode2";
Bar.Direction = System.Data.ParameterDirection.Input;
Bar.Value = CBarcode2;
cmdDisplay1.Parameters.Add(Bar);
daDisplay.Fill(dsDisplay,"Transactions");
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
return false;
}
return true;
-- modified at 5:31 Thursday 24th August, 2006
|
|
|
|
|
I assume that you have a problem with this code, and you're not just sharing it for fun ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Actually this is quite useful. I've been awake all night try to figure out how to how query the database and fill a dataset. I could have gotten more sleep if I'd have only waited for this post.
only two letters away from being an asset
|
|
|
|
|
|
hi all,when i send the mail using smtp server(localhost) i can't receive any mail in the mailroot folder(even with out any error) what will be the problem....
here is my code........
SmtpMail.SmtpServer="localhost";
MailMessage msg=new MailMessage();
msg.To=txtto.Text;
msg.From=txtfrom.Text;
msg.Subject=txtsub.Text;
msg.Body=txtmsg.Text;
SmtpMail.Send(msg);
ayyp
|
|
|
|
|
ayyp wrote: SmtpMail.SmtpServer="localhost";
is your computer a smtp server?
if not, please change this to a right one.
|
|
|
|
|
if we set like SmtpMail.SmtpServer="localhost";then it will drop the mails in inetpub\mailroot\draft... am i correct....?
ayyp
|
|
|
|
|
I don't know.
you can test it. if you find the email you send to localhost, you are correct.
|
|
|
|
|
Im a VB.NET programmer currently working with C#, I am having following questions.
How to create a function with optional parameters ?
Is there any function exist like "CallByName" in VB.NET ?
|
|
|
|
|
iprasad007 wrote: How to create a function with optional parameters ?
And in a matter of moments, you've found the one thing that VB.NET has and C# does not. I have complained to the C# team, they don't care.
So, you need to create two methods, one with the extra param, and one that calls the extra param version with the default. Sucks, I know.
iprasad007 wrote: Is there any function exist like "CallByName" in VB.NET ?
Depends, what does it do ?
Just googled. VB.NET still does that ? That sucks. You should stay clear of anything in the VisualBasic namespace, that's .NET pollution right there. You can use reflection to find methods on an object, perhaps that will do what you need here.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thank you so much Christian.
So in first case I need to code same Business Logic twice, or is there any standard method to write the function once and prototyping it many times ?
For instance I can write function with all params ones, then can write many functions with same names but with few parameters then of original. But still i need to write code to call original function hence the overhead of maintaining all the functions (while change or documentation). Is this is the last way to do ?
And now about my second question, sorry really I didant got what shud I do when I need to call a function or set a property by softcoding such as CallByName does in VB.NET.
Waiting for your reply
Prasad
P.S. BTW ur blog is good
|
|
|
|
|
iprasad007 wrote: P.S. BTW ur blog is good
*blush* thanks. I need to post something on it tho.
iprasad007 wrote: So in first case I need to code same Business Logic twice, or is there any standard method to write the function once and prototyping it many times ?
Only ever code your business logic once. Like this
int SortStuff(SortBy sortBy, SortOrder sortOrder
{
// lots of sorting code
}
int SortStuff(SortBy sortBy)
{
return SortBy(sortBy, SortOrder.Ascending);
}
Note, the enums in this method are made up to make the point.
iprasad007 wrote: And now about my second question, sorry really I didant got what shud I do when I need to call a function or set a property by softcoding such as CallByName does in VB.NET.
Why would you want to do such a thing ? I think it sucks, I don't see how that method is in any way validating that the method in question exists. If you want to discover methods and call them, you need to use reflection ( google reflection C# and you'll see it's a complex subject, but it's exactly what you need here ).
Worst case scenario, you can import the VisualBasic dll/namespace into yuor C# app and call the old VB methods, but ideally you shouldn't do that, even if you're using VB.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|