|
Hello,
I am hosting my website with LunarPages who dont allow remote connection of SQL server. But I have developed my websites using local instance of SQL Express and kept mdf files in APP_DATA folder. So, I wanted a tool which can synchronize my local sql express mdf file with remote sql server. As SQL manager type software could do this things but they need to connect my remote sql server which is not allowed. I wanted to make a software by myself who can read a local .mdf file and generate SQL script (i.e. CREATE TABLE, INSERT INTO ) etc and communicate with an ASP.NET page and ASP.NET page will synchronize the SQL server database by executing the SQL query (CREATE TABLE....). Now Can you tell me which software or library can help me to generate sql create table / insert statements from local MDF file and at how can I read the SQL server database and get SQL statement again to build an mdf database in my local pc. In that way I can develop ASP.NET web application in my local pc with local mdf file with peace of mind. And at the same time if i can convert my remot sql server database to mdf file that will be a nie back up system for me.
Thanks
EMRAN
|
|
|
|
|
Have got a bit confuzzed reading the contributions on Reflection! My need is simple - I have a class in assembly 'myprog.exe' that has Constants for two strings representing the Version (e.g "xxxxx version 1.0") and an issue number nnn (e.g. "xxxxxx nnn yyyyyy"). During an update procedure, I need to check the values in the current installed version. I can load the current installed assembly 'myprog.exe' via the Registry, but don't understand how to pick up the two constants.
The Constructor for the class puts the constants in two 'easy access' variables. I update the two constants for each release.
Help please!
Pensioner Graham Dean
|
|
|
|
|
Hello
Graham Dean wrote: have a class in assembly 'myprog.exe' that has Constants for two strings representing the Version
Why?? Why not check the version of the assembly itself??
Graham Dean wrote: I can load the current installed assembly 'myprog.exe' via the Registry, but don't understand how to pick up the two constants.
Try this -Your constants must be public of course-:
using System.Reflection;
private void MyMethod()
{
Assembly MyAssembly = Assembly.LoadFile("MyFilePath.exe");
Type MyType = MyAssembly.GetType("MyClassName");
object MyOb = MyAssembly.CreateInstance(MyType.FullName);
if(((MyClassName)MyOb).ConstantA == MyValue)
{
//Do anything
}
}
Frankly I don't like the idea at all -no offense please -, yet I answered your question just the way you asked.
My opinion is to check the version of the assembly file itself. it's a lot easier, and won't make much difference -I think-
I hope the code is clear;) I haven't tested it, but it should work.
|
|
|
|
|
Thanks. I am new to .NET, hence my confusion - although programming since 1965! I perhaps should have used the file version, and will next time. Your clear answer has (I think) got me over the current hurdle!
Thanks again
Graham
Pensioner Graham Dean
|
|
|
|
|
Nearly there - but:
Assembly asm = Assembly.LoadFile(mrttexe);
Type TPInfo = asm.GetType("TProgInfo");
Object tpinfo = asm.CreateInstance(TPInfo.FullName);
string asmver = ((TProgInfo) tpinfo).MRTTVER;
Last fails to compile:
Error 1 Static member 'MRTT.TProgInfo.MRTTVER' cannot be accessed with an instance reference; qualify it with a type name instead
I have tried various combinations, including referencing the Class TProgInfo (as above) via the TProgInfo.cs file.
Pity the Internet wasn't around in 1965!
Pensioner Graham Dean
|
|
|
|
|
Hello again
Graham Dean wrote: although programming since 1965!
Wow!! I wasn't even born yet!!
Graham Dean wrote: Error 1 Static member 'MRTT.TProgInfo.MRTTVER' cannot be accessed with an instance reference; qualify it with a type name instead
Well the error message was clear, & I told you I haven't tested the code -Sorry. My mistake -, Yet everything has a solution.
All in it is that the code will change a bit, here is the new version:
using System.Reflection;
private void MyMethod()
{
Assembly MyAssembly = Assembly.LoadFile("MyFilePath.exe");
Type MyType = MyAssembly.GetType("MyClassName");
FieldInfo fi = T.GetField("ConstantA");
int Val = (int)fi.GetRawConstantValue();
if(Val == MyValue)
{
}
}
As you might have noticed that constant fields in C# are automatically considered as static members. So, you can't call them using instances. Here you will check the value using the name of the class itself, as shown above. Unlike last time, where we created an instance of the class.
I tested the code this time. & I Hope it won't disturb you anymore.
More regards
|
|
|
|
|
Nader and I had an 'off forum' discussion. I confused him further by revealing (a little late) that the constants were strings! Solution was to insert Properties in the Class to be reflected that return the strings then use code:
Assembly asm = Assembly.LoadFile(filename);
Type TPInfo = asm.GetType("MRTT.TProgInfo",true);
PropertyInfo pf = TPInfo.GetProperty("CONSTVER");
Object TI = asm.CreateInstance(TPInfo.FullName);
string constval = pf.GetValue(TI, null).ToString();
Thanks again Nader - works like a charm!
Pensioner Graham Dean
|
|
|
|
|
i have different textboxes in my from on one textbox when i press a tab key i want print one messagebox i am writing thiss code but its not working on tab key although its working on like back key but not on tabkey
plz tell me
Private Sub ItemCode_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ItemCode.KeyPress<br />
If (e.KeyChar = Microsoft.VisualBasic.ChrW(9)) Then<br />
MessageBox.Show("u have pressed tab key")<br />
<br />
End If
|
|
|
|
|
Hello
Is that Visual basic?? You're in the wrong forum. You should go to Visual Basic .Net forum[^]
A quick hint quoted from MSDN in the KeyPressEventArgs remarks:
"You cannot get or set the following keys:
The TAB key.
INSERT and DELETE.
HOME.
END.
PAGE UP and PAGE DOWN.
F1-F2.
ALT.
Arrow keys.
"
So if you want to catch the tab key, use the KeyUp event instead
Regards
|
|
|
|
|
in my setup project
i want my project to check if there exist .Net Framework or No if no instaul it automatic and then instaul my program
how can make this ?
Palestine
|
|
|
|
|
Hello
Follow these steps
1- Right click on the setup project's name in the solution explorer
2- Click on properties
3- Click on the prerequisites button
4- Check on "Create setup progra to install..."
5- Check on your prerequisites -according to your project's needs-
6- Cho0se "Download prerequisites from the same location as my application"
NB.
Please don't take any offense, but revise your english before posting
Regards
|
|
|
|
|
I would like to programatically add in a field to a crystal report at runtime. Does anyone know how I would do this? Thanks.
|
|
|
|
|
Can someone direct me to a good IRC client library in C#\.NET?
I've downloaded Meebey's library but it has alot of bugs and troubles.
If someone has a better one, please send me.
Thanks alot.
NaNg.
|
|
|
|
|
|
I just downloaded that...
Is there an informative article about that?
|
|
|
|
|
|
|
|
Wow I just finished reading the documentation that I needed to read. and i just wanna say, that this is MUCH MUCH MUCH more convinient than Meebey's.
Thanks alot for the documentation.
Realy realy thanks.
NaNg. ^^
|
|
|
|
|
Friends,
I've a Win32 handle to a window of type SysListView32. I want to attach this Window handle to .NET managed object of type ListView . Back during the days of MFC/C++ we did it something like:
CListView *pListView = CWnd::FromHandle(hListView);
size_t itemCount = pListView->GetItemCount();
How can i do the same in C#? The reason behid doing so is that i want to call the methods of ListView object to perform operations on ListViewControl such as getting number of items, clearing all items e.t.c.
Imtiaz
|
|
|
|
|
Hello
Imtiaz Murtaza wrote: I've a Win32 handle to a window of type SysListView32. I want to attach this Window handle to .NET managed object of type ListView.
I don't think it's possible!! The two types are totally different. It's like attaching the handle of a dialog to a windows form.
Imtiaz Murtaza wrote: The reason behid doing so is that i want to call the methods of ListView object to perform operations on ListViewControl such as getting number of items, clearing all items e.t.c.
Sorry!! You got to do it with its native functions
|
|
|
|
|
In drawing event I can change fonts, colors and such properties of tooltip.
I can draw a picture but it seems there is no direct way to change the size of the tooltip
I have to change the bounds. If there is an alternative way, it is also acceptable.
thanx
|
|
|
|
|
Hello
If you want to increase the bounds of a ToolTip, override the Popup event handler, and change the PopupEventsArg.ToolTipSize property.
|
|
|
|
|
HI
I want to convert a word file to pdf file how should can i do it using c#.
Also I am using vs.net 2003 and .net framework 1.1.
Thanx
praveen
|
|
|
|
|
This is a pretty broad question. Word does have export filters for PDF. If you are talking about a generic solution that will take a .DOC file and convert it to .PDF without an interaction, there are quite a few commercial libraries out there that you can link into your application that will do the job.
|
|
|
|