|
Good afternoon,
i have one c# class known as EXTdata implementing IEXTAccess
i want to create an instance of EXTdata inside javascript function doScript().
my html code is here.
<title>Untitled Page
<object id="myControl1" name="myControl1" classid="EXTViewer.dll#EXTViewerLib.EXTViewer" width="100%" height="90%">
function doScript()
{
var filepath = document.getElementById("openFileDialog").value;
myControl1.SetIEXTAccess = <b>/* here should be instance of c# class new EXTdata(filePath); */</b>
return true;
}
i am not getting how to instantiate c# class implemeting some interface inside javascript
Any suggestion or sample code if any one have it.
Thanks in advance.
DaTtA.
way2datta@gmail.com
|
|
|
|
|
One way is to create a COM wrapper around the C# class.
The COM can then be instantiated in javascript using the ActiveXObject object.
«_Superman_»
|
|
|
|
|
Thanks a lot!!!!
but can i get tutorial or some thing that will help me to wrap the class inside COM.
|
|
|
|
|
|
Hi All,
OleDbDataAdapter.Fill(DataSet)
We do have a summary screen, displaying all books information using GridView from BookMaster Table in Access
DataBase.OleDbDataAdapter.Fill() method to fill dataset and bind the dataset to GridView. In Summary Screen, there is an option to insert data, of newly purchased Books.Once New Data is entered, it redirects back to summary screen.
Problem is newly entered record is not populated in GridView. If we refresh the page or reload the
page, new data is populated.
Can someone help me to solve this problem.
Thank you in advance
|
|
|
|
|
rema r wrote: Problem is newly entered record is not populated in GridView. If we refresh the page or reload the
page, new data is populated.
One way to handle this is that you really refresh the dataset from the database to reflect the current situtation in the database. Especially in multi-user environments it's typical.
However if the row inserted using a gridview goes to the dataset and from there it goes to the database and in that point it get's deleted from the gridview, I would guess that the gridview refreshes with old data. But without seeing the code it's hard to identify the problem.
|
|
|
|
|
Hi,
Thank you very much for your immediate reply.
Have attached code herewith for binding GridView from Ms Access DB
string strsql = "select BookId,BookName,Author,Editon from BookMaster";
OleDbDataAdapter adapter = new OleDbDataAdapter();
OleDbCommand command = new OleDbCommand(strsql, "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Testing\Library_db.mdb;");
adapter.SelectCommand = command;
DataSet ds = new DataSet();
adapter.Fill(ds, "roads");
GridView1.DataSource = ds;
GridView1.DataBind();
Thank you
|
|
|
|
|
Glad it helped.
|
|
|
|
|
Hi,
I am new to .net and may be this question is very basic..but I did not find much info on standard controls when I browsed.
I need to make a small application where the users would select a file for processing.
What controls can I use in .net so that the users get a windows explorer like file selector when they click on the button. The file they select should be passed as an argument to some other program.
Thanks
RS
|
|
|
|
|
You can use the FolderBrowserDialog or OpenFileDialog controls to provide dialogs that allow the user to select a folder/file.
Or you can build your own custom one using comboboxes, treeviews and listviews. You'll need to handle the various changed events and populate them all appropriately when the users clicks and changes things. (Tip: You can set the auto complete source on a combo box to "FileSystem" to give a kind of explorer style directory typer box.)
Probably easiest to just use the OpenFileDialog though.
Simon
|
|
|
|
|
Hi,
You didnot mention which version of .Net are you working on?
Anyways, if you are using .net 2.0 you can use fileupload control by which you can select the file same as you select in windows.
Just add below code on page_load event.
Button1.Attributes.Add("onclick","document.getElementById(' " + FileUpload1.ClientID+ "').click()");
Where button1 is the id of the button you want to open the browser window when being clicked and FileUpload1 is the id of the file upload control.
But if you are using .net 1.1 you need to write code explicitely for opening window explorer like file selector. There are some classes defined in framework for that.
Hope this will help.
Cheers
Shilpa
|
|
|
|
|
Nope, he can't. From the message context it seems he is developing a desktop app, and you are talking Asp.Net
Regards,
Lev
|
|
|
|
|
Hi... I have a problem and quite frankly I'm stumped
One of our clients is repeatedly getting the "Timeout expired. the timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached."
The common cause of this error is ofcourse the connection pool being exhausted, but this seems extremely unlikely - the connection keeps the default max pool count (of 100?), and the client has been unable to use this specific application since day 1. Secondly, the timeout on my connection is set to 120, but the client receives the dialog ~20 seconds after attempting to start the application.
The client is also able to start the application from another computer, using the same login (which should lead to the same connection string, and hence the same connection pool). The client is able to connect to the database using other (non .net) applications on his system. I have asked him to try and start other .net apps that connect to the database in a similar fashion as mine, unfortunately the client is Chinese, and not technically minded, which makes communication very hard.
Basically, I'm just looking for ideas for a line of investigation. Anyone have a clue?
|
|
|
|
|
I got the impression thet the application resides on the client machine and the connection pool also is located at the client. If so, does the client located application connect to the database directly? If it does, could it simply be that this client isn't able to connect to the database at all using the connection string in the application.
|
|
|
|
|
That does seem to be the case. Oddly enough with a different username he gets another error (Named Pipe Error 40), but it boils down to a connection not establishing. I'm going to try to get him to set his DSN to use TCP rather than Named Pipes, but this is basically clutching at straws.
|
|
|
|
|
In that case the pool may be exhausted since it's user specific. If after a reboot he gets the error with the original username, it may be that the connection can't be established (for example sql server isn't listening on named pipes) and if that error occurs several times the pool may be depleted. So you may have two partly different problems at the same time.
Since he gets a named pipes error it's good to start resolving that by changing the protocol. After it's worked out concentrate on the connection problem (if it exists anymore).
|
|
|
|
|
Just a swag, but since only one client machine is affected, could that machine have the wrong Jet db engine installed?
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
As a matter of interest, have you ensured that the connections have been disposed immediately after use? If you are acquiring connections for each database operations, it could be that the connection hasn't been closed and returned to the pool.
If you're using an enterprise database server, try monitoring the connections.
|
|
|
|
|
I did check the connections to the server with sp_who and by reading from sysprocesses, there are no connections open with his username when he is not actively using our system, and even when he is, there are 5 or less (with a max pool size of 100)
Is there a more efficient way of monitoring database connections?
|
|
|
|
|
Yes - you can monitor connections using SQL Profiler. I have an article here[^] that might help - it's not about monitoring connections, but the basic principals are the same, all you need do is change the events you want to monitor.
|
|
|
|
|
Hi,
I am using databindings to populate a combobox and several textboxes from a single datatable. When I select a record from the combobox, details of that record are displayed in the textboxes. This part of databinding works fine but when I make changes to the textboxes I want to update those changes back to the database. This update part is not working for me. No runtime errors but the db does not change. Can anyone help me? I am using a typed dataset "dsMySQL". My code is as follows:
// code for form_load
myDataAdapter.Fill(dsMySQL.DaySchoolsTbl);
cbxDaySchools.DataSource = dsMySQL.DaySchoolsTbl;
cbxDaySchools.DisplayMember = "SchoolName";
cbxDaySchools.ValueMember = "SchoolID";
tbxSchoolID.DataBindings.Add("Text",dsMySQL.DaySchoolsTbl,"SchoolID");
tbxSchoolName.DataBindings.Add("Text",dsMySQL.DaySchoolsTbl,"SchoolName");
cbxSchoolType.DataBindings.Add("SelectedIndex",dsMySQL.DaySchoolsTbl,"SchoolType");
// code for save_button
myDataAdapter.Update(dsMySQL.DaySchoolsTbl);
dsMySQL.DaySchoolsTbl.AcceptChanges();
|
|
|
|
|
Put a breakpoint on the row:
myDataAdapter.Update(dsMySQL.DaySchoolsTbl);
and check that the modifications are in the dataset and that the RowStates for the modified rows are not Unchaged . One reason could be that you accept all changes somewhere in the code before updating the data adapter.
Also you don't have to call dsMySQL.DaySchoolsTbl.AcceptChanges(); after update since if the update is succesful, it automatically accpets the changes. Actually, if something goes wrong during the update and you accept changes, the updates not yet taken to the db are lost.
|
|
|
|
|
Mika, thanks for your reply.
I have done a debug as you suggested and found that the row item in question has changed (when I changed the tbxSchoolName) but the RowState remains "Unchanged". Do you know why?
The test I am doing is simple enough, I display the form which loads the controls. I select a record from the Combobox which populates the Textboxes. I make a change to the Textbox. I click the 'Save' button to do the Update().
I have noticed that my changes in the Textbox 'tbxDaySchoolName' is not reflected in the Combobox 'cbxDaySchools'.
I have done a search and AcceptChanges() is not used on this form any more.
Obviously my 'select' command works but here is the code for the 'update' command:
// The Update command handles updates to existing rows
cmdUpdate = myConnection.CreateCommand();
cmdUpdate.CommandText = "UPDATE DaySchoolsTbl SET SchoolName=?SchoolName, SuburbID=?SuburbID, SchoolType=?SchoolType WHERE SchoolID=?SchoolID";
myParameter = cmdUpdate.Parameters.Add("?SchoolID", MySqlDbType.Int16, 40, "SchoolID");
myParameter = cmdUpdate.Parameters.Add("?SchoolName", MySqlDbType.String, 40, "SchoolName");
myParameter = cmdUpdate.Parameters.Add("?SchoolType", MySqlDbType.Byte, 1, "SchoolType");
myParameter = cmdUpdate.Parameters.Add("?SuburbID", MySqlDbType.Int16, 40, "SuburbID");
myParameter.SourceVersion = DataRowVersion.Original;
myDataAdapter.UpdateCommand = cmdUpdate;
Any idea what the problem is??
thanks
|
|
|
|
|
dragon_n_me wrote: row item in question has changed (when I changed the tbxSchoolName) but the RowState remains "Unchanged".
So the data in the column changes, but the row's RowState doesn't? Try to check the RowState immediately after you have modified the data (using tbxSchoolName). If the RowState is unchanged in that point, check the data bindings of the textbox. If it's changed, then you should investigate what clears the status after that.
|
|
|
|
|
I stopped at tbxSchoolName_Validating and neither data nor state has changed. I stopped at tbxSchoolName_Validated and only data has changed but RowState = "Unchanged". What can happen in between these 2 events?
|
|
|
|