|
You are not setting the Document property of the PrintPreviewDialog for sure. Please check.
Live Life King Size
Alomgir Miah
|
|
|
|
|
i am using remote data access for my project. this is my code.
private void button2_Click(object sender, System.EventArgs e)
{
SqlCeConnection cn = null;
SqlCeRemoteDataAccess rda= null;
SqlCeEngine sqlEngine=null;
try
{
button2.Enabled=false;
//Create database if it doesn't already exist
if(!File.Exists("\\My Documents\\Student.sdf"))
{
sqlEngine=new SqlCeEngine( );
sqlEngine.LocalConnectionString="Data Source=\\My Documents\\"+
"Student.sdf;"+
"Password= ;"+
"Encrypt Database=True";
sqlEngine.CreateDatabase();
sqlEngine.Dispose();
}
else
{
//open the connection to the database
cn=new SqlCeConnection("Data Source=\\My Documents\\"+
"Student.sdf; Password=");
cn.Open();
SqlCeCommand cmd=cn.CreateCommand();
//drop table tutorial1_Classlist
cmd.CommandText="DROP TABLE tutorial1Class_list";
cmd.ExecuteNonQuery();
//close the conection
if(cn.State!=ConnectionState.Closed)
{
cn.Close();
}
}
//Instantiate the RDA Object
rda=new SqlCeRemoteDataAccess();
//Connection String to the Sql Server
string remoteConnectString="Provider=SQLOLEDB;"+
"Data Source=IT768P27;"+
"Initial Catalog=Student;"+
"User Id=sa;" +
"Password=";// empty password
rda.InternetLogin="";
rda.InternetPassword="";
rda.InternetUrl="http://IT768P27/StudentRDA/sscesa20.dll";
rda.LocalConnectionString="Data Source=\\My Documents\\"+
"Student.sdf;"+
"SSCE:Database Password=";
rda.Pull("tutorial1Class_list", "Select * from tutorial1Class_list",
remoteConnectString,RdaTrackOption.TrackingOn);
}
catch(SqlCeException sqlex)
{
foreach(SqlCeError sqlError in sqlex.Errors)
{
MessageBox.Show(sqlError.Message,"Error");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message,"error");
}
finally
{
rda.Dispose();
button2.Enabled=true;
}
}
when i run it in my pocketpc ,it give me error like "sql server ce encountered problems in creating the sql server ce database[...connection string..]..
what should i do.. i c every codeing is all right. can u tell me what is wrong with my connection string?
|
|
|
|
|
I see that no one ever replied to this....I hope you found the answer!
But if not...the RDA connection expects IIS at the receiving end. //MyDocuments// is not a well-formed URL for going to a web server.
However if you have IIS running then at a minumum your web would be something like:
"http://myMachineName/SqlHost" assuming your RDA host connection
is in the web SqlHost.
So you need your host name and web name for a well structured IIS connect to your database.
There are 10 kinds of people in the world.
Those that read binary...
...and those who don't.
|
|
|
|
|
Hi.I need to work with Calendar Control .Can you show me where can I find any good tutorials or examples on this topic .Thank you
|
|
|
|
|
I would suggest that you got voted a 1 for two reasons
1. 'How can I' is not a decent way to head your question, I thought you'd posted the same question twice
2. Google will answer both of these questions in seconds.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi.Can you show me any tutorial about editing the information of a database which is shown in datagrid.I need to add ,delete,update information interacting only with the grid.Thank you
|
|
|
|
|
Hi!
Im making a form which displays data on a datagrid when i select an item from my dropdownlist. Now my problem is nothing shows up when i choose from my dropdownlist. can someone please check and see if my code is correct because it builds perfectly infact it shows the header but leaves the rest of my queries. Here's parts of the code assuming that my sql queries are correct which i've great confidence that the are:
<br />
DataSet dsCompany = new DataSet();<br />
dsCompany = objComp.fGet_Company();<br />
ddlcomp.DataSource = dsCompany;<br />
ddlcomp.DataTextField = "comp_code";<br />
ddlcomp.DataValueField = "comp_desc";<br />
ddlcomp.DataBind();<br />
ddlcomp.Items.Insert(0,"");<br />
<br />
Session["Comp"] = ddlcomp.SelectedItem.Value;<br />
Session["CompName"] = ddlcomp.SelectedItem.Text;<br />
<br />
if (Session["Comp"].ToString() != "")<br />
{<br />
ddlcomp.Items.FindByValue(Session["Comp"].ToString()).Selected = true; <br />
}<br />
<br />
private void ddlcomp_SelectedIndexChanged(object sender, System.EventArgs e)<br />
{<br />
DataSet dsCol = new DataSet();<br />
dsCol = objCol.GetByClient(ddlcomp.SelectedItem.Value);<br />
<br />
Session["dstSort"] = dsCol;<br />
Session["dtvwSort"] = dsCol.Tables[0].DefaultView;<br />
dgdGrid.DataSource = dsCol;<br />
dgdGrid.DataBind();<br />
}<br />
so...anything wrong with this?
thanx for all your comments, suggestions and reactions!
Kampai!!!
|
|
|
|
|
tatchung wrote:
because it builds perfectly
So what ?
tatchung wrote:
DataSet dsCompany = new DataSet();
dsCompany = objComp.fGet_Company();
this is dumb - the new dataset you created will now go into the queue for garbage collection, as you replaced it righ away with the result of this call.
tatchung wrote:
ddlcomp.DataSource = dsCompany;
ddlcomp.DataTextField = "comp_code";
ddlcomp.DataValueField = "comp_desc";
ddlcomp.DataBind();
ddlcomp.Items.Insert(0,"");
None of this is in a !IsPOstback block, so it binds every time, and your selection is lost.
tatchung wrote:
Session["Comp"] = ddlcomp.SelectedItem.Value;
Session["CompName"] = ddlcomp.SelectedItem.Text;
These will always be the first item in the list, as you just did a databind and an insert.
tatchung wrote:
dsCol = objCol.GetByClient(ddlcomp.SelectedItem.Value);
Events fire after page load and before prerender. Not knowing where you did the above, I have no idea what the SelectedItem could be at this stage.
tatchung wrote:
DataSet dsCol = new DataSet();
dsCol = objCol.GetByClient(ddlcomp.SelectedItem.Value);
Waste of memory again.
tatchung wrote:
Session["dtvwSort"] = dsCol.Tables[0].DefaultView;
You're shoving a whole table into the session ? You seem to be using session state a lot, is all of this stuff needed on other pages ? AND you shove it in twice, as dstSort and dtvwSort. This is not ASP. Why do you need this information in the session ?
tatchung wrote:
so...anything wrong with this?
The lack of an !IsPOstback is probably your core problem.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Like I said its only part of the code. Sori i couldn't post every part of the form its too long. I've an !IsPostBack right below my Page_Load member along with my "pop-up window" code. Oops! I forgot to mention that this form links to a pop-up window...my bad . Ohe yeah the datasets created was meant to draw the data from a class i've made in another form. Darn me for skipping too many information.
Ok so here's the deal this form generates data from a database when i fire the dropdownlist. Along with the results it should display 2 buttons for each row; edit and delete. Now when I click the edit button it redirects to my pop-up window and delete...well it deletes the entire row it is aligned with. Back to my first thread...nothing seems to appear when i choose from my dropdownlist except the headers.
I appologize for any misinformation or rather for lack of information. All your replies are greatly appreciated! Thanx for all your assistance!
Kampai!!!
|
|
|
|
|
tatchung wrote:
I've an !IsPostBack right below my Page_Load member along with my "pop-up window" code.
So the Data binding code is in an !IsPostback block ?
tatchung wrote:
Ohe yeah the datasets created was meant to draw the data from a class i've made in another form. Darn me for skipping too many information.
But why are you stuffing them into the session, and duplicating info into the session ?
I still think nothing appears because you're resetting your data source. Have you stepped through the code in debug mode ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Oops...I got it. I've inverted the dropdownlist DataTextField and the DatValueField in my SelectedIndexChange method. Sori for bothering you Chris but I've got another question about row deletion. If you could just please check the recent post I've made a new thread. Thanx so much! Your help is invaluable
Kampai!!!
|
|
|
|
|
We never addressed why you're stuffing all this stuff in the session.....
I think I read the other question and asked to see the code.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Nah its a new thread. Well I was under the impression that sessions where meant to keep data to be passed to another form. I got it from another form which does almost the same thing that my form does. Semi-plagarism but I was totaly cluless when I started this project and i was under intense time constraints
|
|
|
|
|
tatchung wrote:
Nah its a new thread.
Answered.
tatchung wrote:
Well I was under the impression that sessions where meant to keep data to be passed to another form.
But why are you passing a dataset to another form, AND a view you can derive from that dataset ? Isn't that expensive ? Why can't you just pass the info needed to get that data from your data layer ?
tatchung wrote:
Semi-plagarism but I was totaly cluless when I started this project and i was under intense time constraints
Why are you on a project at all, if you don't know what you're doing ? Seriously, there's nothing wrong with being a beginner, but a project with time constraints is not the place to do it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks for your reply.
Hi,
I have problems in using multi-threading.
What I want to do is as follow,
1. The main thread running the main window GUI as window form
which can accept user input all the time.
2. The second thread running some task,
and after the task is finished, the thread need to ask
main window form(controlled by the main thread) to display some
child window. But I find that the child window will not function
properly as two threads try to control the same GUI at the same time.
So I want to pass the control from the second thread to the main thread
and let the main thread open the child window itself.
Then how can I do that ? I don't want to use Thread.Join since the main thread need to run all the time and cannot be blocked.
Thanks
|
|
|
|
|
You shouldn`t create the new window in the separate thread. Give your main form a function which gets all info needed to create the child window and then call this function from your worker thread by calling Invoke with the new function on the main form. Invoke will transfer the call from any thread into the GUI thread.
All GUI related things should be done in one thread.
|
|
|
|
|
Hi,
Do anyone know will DDE(dynamic data exchange) still be supported
in window longhorn ?
Thank
|
|
|
|
|
I can't imagine why not.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Coz there are always articles saying that DDE is dead,
or just a residue from early window os. So I just afraid
it will be eliminated from future window version.
|
|
|
|
|
COM is, to all extents, dead. But I'm sure the OS will support it, forever. Why make a ton of old code not run anymore, for no good reason ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
what is longhorn i have listened to this term but still today i have no knowledge about it
|
|
|
|
|
The next version of window
|
|
|
|
|
Longhorn is the codename for the next generation of Windows, now called Windows Vista.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi,
i wld like to create any app whereby the user is free to press any buttons 1-10 simultaneously and the forms belonging to the respective buttons will be displayed.. eg. when u hit button 1, form 1 will be displayed.. when button 3 is hit, form 3 will display.. however, as my app should allow simultaneous displaying of forms, i cannot use modal forms.. with non-modal forms, too many forms will be displayed and it'll be irritating to look at the computer screen..
** i wld like to allow the user to display many non-modal forms n be able to select among the forms that are displayed, just like many windows can be displayed on the taskbar when i click on many types of icons on the desktop and allows the user to choose the window he wants to do his work..
** is it possible to know which buttons were pressed n allow the respective forms to be displayed in a 2nd form of tabpages? can tabpages be used to display information as if they are windows?
pls let me noe if u've better ideas to display many non-modal forms and in a neat manner instead of displaying so many pop-ups in the screen.. thanks..
many thanks for your answers/suggestions.. =)
|
|
|
|
|
nidhelp wrote:
pls let me noe if u've better ideas to display many non-modal forms and in a neat manner instead of displaying so many pop-ups in the screen.. thanks..
noe ? Goodness me.
A nom-modal form IS a popup, no two ways about it. Perhaps the only way to do it is to limit the number of forms visible at a time, or have your code that responds to the button presses move the forms so they are logically aligned with one another on the screen.
nidhelp wrote:
** is it possible to know which buttons were pressed n allow the respective forms to be displayed in a 2nd form of tabpages?
Absolutely - so you have a single modeless dialog and you add/remove tab pages as someone presses buttons ? Why not just have a form with the 10 tab pages ? You get the same result, except it's more logical to use.
Christian Graus - Microsoft MVP - C++
|
|
|
|