|
You have not given one piece of usable advice. Are you a troll?
- You say "Use sql" but when I ask how, you give no examples and you ask me for what I have tried.
- When I ask how to specify the path for the database, you ignore it.
- When I post my erroneous code, you say it works.
Useless, Useless, Useless.
|
|
|
|
|
brickbat wrote: Are you a troll?
Trolls aren't given MVPs....
brickbat wrote: You have not given one piece of usable advice.
He has. I'll add, use SQL Express instead of Access...
|
|
|
|
|
brickbat wrote: Data Source=.\\SQLEXPRESS
This is the path. It is the local instance of SQL Server Express that has been installed on the system the applicaiton is running on. You could also use something like Data Source=MyDB.mdf for a file based database for the application.
Again, with all of the refences you have claimed to have read I find it difficult to believe this has not been explained.
only two letters away from being an asset
|
|
|
|
|
|
To the trolls, MVP or not - Thanks for no help. Here is correctly working code for those that might be interested. Obviously, the Server location, the database and logfile paths, and the size parameters may need to be changed to suit the application. I will not be using this because as I thought, you need to have an sql server running for this to work. I will not require my users to have an sql server constantly running because of a small finance application which they may use once per month.
Here is correctly working code
<br />
String str;<br />
SqlConnection myConn = new SqlConnection("Server=local\\SQLEXPRESS;Integrated security=SSPI;database=master");<br />
<br />
str = "CREATE DATABASE MyDatabase ON PRIMARY " +<br />
"(NAME = MyDatabase_Data, " +<br />
"FILENAME = 'E:\\MyDatabaseData2.mdf', " +<br />
"SIZE = 2MB, MAXSIZE = 10MB, FILEGROWTH = 10%) " +<br />
"LOG ON (NAME = MyDatabase_Log, " +<br />
"FILENAME = 'E:\\MyDatabaseLog2.ldf', " +<br />
"SIZE = 1MB, " +<br />
"MAXSIZE = 5MB, " +<br />
"FILEGROWTH = 10%)";<br />
<br />
SqlCommand myCommand = new SqlCommand(str, myConn);<br />
try<br />
{<br />
myConn.Open();<br />
myCommand.ExecuteNonQuery();<br />
}<br />
catch (System.Exception ex)<br />
{<br />
MessageBox.Show(ex.ToString(), "MyProgram", MessageBoxButtons.OK, MessageBoxIcon.Information);<br />
}<br />
finally<br />
{<br />
if (myConn.State == ConnectionState.Open)<br />
{<br />
myConn.Close();<br />
}<br />
}<br />
|
|
|
|
|
Mark Nischalke wrote: You could also use something like Data Source=MyDB.mdf for a file based database for the application.
Again, with all of the refences you have claimed to have read I find it difficult to believe this has not been explained.
WRONG. WRONG. WRONG. Your signature is very appropriate. For people really interested in how this works, check my other post to see actually working code.
|
|
|
|
|
Hello everyone,
I have a Windows Application with a Button which can have various Images. As the image in the Button changes, I would like to create the illusion of appearing slowly rather than just popping up.
I am wondering if it is possible to change the transparency of an image displayed in a button programaticly?
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
Hello,
Maybe you can work with a little trick here,
The System.Windows.Forms.Form has a property called Opacity (0% to 100%).
If you create a Form and display it over your form with opacity = 0.0 (0%).
Than setup a timer with low intervall (50ms for example).
On the timer tick you increase the opacity +0.1;
If the opacity is 1.0(100%) you can change the Image and start decreasing the opacity again till it is 0.0.
I'm sure there is a much cleaner solution.
Maybe if you inherit YourButton from Forms.Button and handle the OnPaint event.
In that you can do you painting like you whant!
Hope it helps!
All the best,
Martin.
|
|
|
|
|
Ok, I just figured out a solution for ya. You'll have to override the OnPaint to use it, of course. To see the effects, set the button's BackgroundImage to some arbitrary picture (Just for testing), then set an IMAGEPATH const to the pic to draw...
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
System.Drawing.Imaging.ImageAttributes attr = new System.Drawing.Imaging.ImageAttributes();
System.Drawing.Imaging.ColorMatrix matrix = new System.Drawing.Imaging.ColorMatrix();
matrix[3, 3] = 0.2F;
attr.SetColorMatrix(matrix);
Image img = Image.FromFile(IMAGEPATH);
e.Graphics.DrawImage(img, ClientRectangle, 0F, 0F, img.Width, img.Height, GraphicsUnit.Pixel, attr);
}
Quick explanation...
I don't know how familiar you are with transformation matrices, but graphics operations generally work with 4x4 matrices for 3D position transformations and 3D color transformations. In the case of a color one, the four rows/columns stand for R, G, B, and Alpha (Opacity).
The default matrix is an identity matrix:
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
And this is equivalent to multiplying each component by 1. We're changing element [3,3], the last 1, into a 0.2. This leaves R, G, and B alone, but multiplies the Alpha component by 20% before outputting it.
(Obviously, change 0.2 to any value from 0=Transparent to 1=Opaque)
|
|
|
|
|
Hi!
I want to send a SMS with an UMTS/HSDPA modem (HUAWEI Model: E220) in my C# application.
This moden is from the austrian provider T-Mobile and you can send with the attached application SMS.
Any ideas?
regards
spotl
|
|
|
|
|
First time to pose a question on this board...fairly new to C# too, so please go easy
I want to do something like this in Generics:
List<int, String[]> myList = new List<int, String[]>();
This blows up obviously...any workarounds? Thanks!
Mikeyyy
|
|
|
|
|
I don't know why, but half of the syntax didn't show:
List<int, String[]> myList = new List<int, String[]>();
|
|
|
|
|
Ignore my other reply, I assumed you didn't pass the type of element, the html formatting actually removed it.
The list can have only one type, so it would be List<int><string> myList = new List<string><int>(); or List<int><string> myList = new List<int><string>();</string></string></int></int>
If your are looking at having a KeyedList then have a look at this article[^]
|
|
|
|
|
|
If you are trying to store two items for each element in the list then you should be creating a class.
class DtoListItem
{
public int SomeInt;
public string[] SomeStringArray;
}
List<DtoListItem> myList = new List<DtoListItem>();
|
|
|
|
|
Thats because it's expecting T which is the type of element in the list. If your creating a list of strings then you should declare it as List<string><string> myList = new List<string><string>();</string></string>
|
|
|
|
|
|
Hello,
I am new to .net i develop a project in that am using C# coding. i used a MDI form in that i declar the Login form as achild to MDI. now i want to lock the MDI parent form, till i give the username and password.
In that application first the MDI parent form is invoked first then it call the login form.
Help plz .....
kethare
|
|
|
|
|
You should open the login form as a dialog rather than the child of the MDI, that way you prevent access to the controls on the MDI form.
|
|
|
|
|
Does anybody know how to create an efficient Undo/Redo Class? What are the general things I need to implement?
may your code be error free
|
|
|
|
|
There are several articles at cp so search
|
|
|
|
|
|
I need to add RADIUS server capability to a application suite I am developing. Does anybody know of a source for a library that will do this easily? Thanks.
|
|
|
|
|
A quick Google search revealed some interesting results, including this one[^].
|
|
|
|
|
I have a grid view that has a number of templated fields. The gridview is populated using a stored procedure. What I want to do is get the values in each cell in a row. But I am not getting any value from the cell. The simplified code is as shown below. Any idea why the code is not showing the value in the cell.
protected void dgPayment_RowEditing(object sender, GridViewEditEventArgs e)
{
try
{
string claimNo = dgPayment.Rows[e.NewEditIndex].Cells[3].Text;
}
catch(Exception ex)
{
ex.Message.ToString();
}
}
|
|
|
|