|
Thanks for the response! I know what you mean about the nested classes and the look of the code. I can target 3.x so that is definitely good to know. I had used generation before and there are some good tools out there, but none for free that solved this specific problem I had written some reflection before for a different problem in which I had only the XML and not any official XSD nor the DB. I might cave and buy an XMLSpy or similar license, but then I'll miss out on learning the trials and tribulations of this whole process. I have used MyGeneration and XSLT for going the other way (SQL DB to XML) and that was fine. But I think the problem this time is that I already have both the schema and the data model which strangely enough seems harder than only having one of them! Getting them to fit together just seems a bit tedious.
|
|
|
|
|
Also, I don't know the SportsML schemas or the database, but you might want to check if the native ADO.NET datasets can be made to load these xml documents. Upon re-reading your original posting it seems to me that your primary goal is to minimize the development effort, and datasets might work quite well for this purpose.
Another interesting possibility is to make a SportsML reader that implements the IDataReader interface - then you can use SqlBulkCopy to bulk insert the data. This gives you the best performance and is fairly easy to do if you can base the object on an existing IDataReader implementation.
For example, we wanted to copy some data efficiently from one DB to another. The data included some parent-child relations, so a foreign key in table Child would refer to a row in Parent. And the keys were IDENTITY values provided by each database, so they would be different in each database.
To deal with this I wrote a simple TransformingDataReader class based on SqlDataReader, which already implements IDataReader. Since SqlDataReader is sealed I couldn't inherit from it, but I just embed a reader in my class and delegate most of the interface implementation to that object, like this:
...
public void Close()
{
sqlDataReader.Close();
}
public DataTable GetSchemaTable()
{
return sqlDataReader.GetSchemaTable();
}
public bool NextResult()
{
return sqlDataReader.NextResult();
}
public void Dispose()
{
sqlDataReader.Dispose();
}
...
The only thing I really wanted to change from SqlDataReader was that when it reads I'd like to be able to modify the data of the row just after it's read internally and before it's passed on to the consumer of the reader. This is easily done like this:
SqlDataReader sqlDataReader;
object[] currentRow;
abstract public void Transform(object[] currentRow);
public bool Read()
{
if (sqlDataReader.Read())
{
sqlDataReader.GetValues(currentRow);
Transform(currentRow);
return true;
}
currentRow = null;
return false;
}
I like this solution since it's now very easy to make a reader that does transformations on the fly. For example, you could load a "correspondance" table if you know that in system A values 1, 2, 3 actually mean the same as X, Y, Z does in another system, and by implementing just Transform() you'd be able to do the transformation on the fly during a bulk insert that streams data from one database to the other.
Just to give you some more ideas!
|
|
|
|
|
I connected with an Access 2.0 file with Server Explorer in VS2008.
It can list all table in this database but when I get all row's data of one table It throw the Exception :
"Record(s) cannot be read; no read permission on 'table's name'"
How can I fix this? Thanks for any help!
QuynhTD
|
|
|
|
|
The account you used to connect to the database doesn't have permissions to read the data in that table. You need to use a different account or change the security in the Access database to allow the account you used better permissions. Don't ask me exactly how to do it because I haven't used Access to store data in years.
|
|
|
|
|
Thanks, but I can't find out how to "change the security in the Access database" or use a different account. Access's menu : Tools>Security> User and Group Permission always disable
QuynhTD
|
|
|
|
|
If that option is disabled, the database isn't setup for workgroup sharing, so a login to the database isn't necessary. The next place I'd look would be the connection string. What does that look like?
|
|
|
|
|
The connection string is: "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DB.MDB"
DB.MDB is an access 97 file. I opened with VS2008. It connect successfully with user ID "Admin" and any password. I can receiver all the tables but can get any record data, it throw message :
---------------------------
Microsoft Visual Studio
---------------------------
SQL Execution Error.
Executed SQL statement: SELECT * FROM TABLE_NAME
Error Source: Microsoft JET Database Engine
Error Message: Record(s) cannot be read; no read permission on 'TABLE_NAME'.
---------------------------
OK Help
---------------------------
QuynhTD
|
|
|
|
|
OK, is there a table in that database called "TABLE_NAME"??
|
|
|
|
|
No, it's common name for all table in this database
QuynhTD
|
|
|
|
|
Hi,
I am not sure that I am posting this to the right forum category. Please advice me if I am in wrong direction.
My application has been migrated from .Net1.1 to .Net2.0 and now I am working on Vistual Studio 2008 and compiled the application to targetting the .Net framework 2.0. This works very fine in the local server. When I deployed the application in the client place it was throwing error when accessing third party com objects. I found that the Server was Microsoft Windows Server 2003 SP2 -64 bit and this is the reason for the error(found the solution in forums). So in the IIS server I added ASP .NET 2.0.50272 (for 32 bit) through the web server extension. Now I can able to run the application and access the com objects. It is running alright for few minutes and it is throwing the error
Retrieving the COM class factory for component with CLSID {83F04DB3-9710-11D5-87F6-005004FEB4BD} failed due to the following error: 800703e6.
If I stop the application pool and the web site and then restart them everything works fine withut any issue for again few more minutes. I searched the forums but it is all confusing. Can any one please help me to come out of this blue?
PS: I found some reference to DEP in the community forums but I am not sure I fall under those category to do disable it. I am bit afraid of play with registries, since it is client's shared server with other applications running.
Please...please... any sort of help will be really appreciated. Thanks in advance.
Cheers
Renu
|
|
|
|
|
Hi,
I'm trying to make a webservice in C#, that plays movie or music. But I've tried many times for attempting to realize this function, but just can't figure it out. I know how to add references of this activex control, but I haven't found a way to use it.
The main problem is that I don't know how to use the activex control with an interface.
Can someone help me or give me an example? Thanks!
|
|
|
|
|
So, you're trying to use the media player in a Web Service project?? I hope you realize that web services don't have a user interface, and hence, you wouldn't be able to see anything that a user interface component displays.
What are you ultimately trying to do with this web service?
|
|
|
|
|
Thank you!
Actually, The reason I want to use the activex control with an interface in webservice is that I'm trying to wrap this control with webservice, and webservice has many advantages.
Instead of using it directly, I wander if there is an indirect way of using this kind of activex control.
I've tried one way, but it didn't work. Then I think I've used this control in a wrong way.
Here are main steps:
1. I create a class library project with C#, and add a user control.
2. After I add the reference of the activex control , I can place the control on the user interface.
3. I write some functions of the control and register for COM interop on the page of its property.
4. I use the .dll file it generates in a website, and it works fine. Then I wonder if I can use it in the webservice as well, so I add the reference of the .dll generated by the project in the web service project.
5. I use it in the webservice like this:
[WebMethod]
public void ShowCamera1(String ipText)
{
using (test2.Camera2 ec = new test2.Camera2())
{
ec.ShowCamera(ipText);
}
} but when I debug it,it genetates an error .
"System.Threading.ThreadStateException: ActiveX control '745395c8-d0e1-4227-8586-624ca9a10a8d' cannot be instantiated because the current thread is not in a single-threaded apartment.
at System.Windows.Forms.AxHost..ctor(String clsid, Int32 flags)
at System.Windows.Forms.AxHost..ctor(String clsid)
at AxAXISMEDIACONTROLLib.AxAxisMediaControl..ctor()
at test2.Camera2.InitializeComponent() in D:\lynn\class\HelloWord\test2\Camera2.Designer.cs:line 32
at test2.Camera2..ctor() in D:\lynn\class\HelloWord\test2\Camera2.cs:line 31
at Service.ShowCamera1(String ipText) in c:\Inetpub\wwwroot\AXIS_webservice\App_Code\Service.cs:line 36"
Perhaps I have used the activex control in a wrong way, but I really want to try to find a way of using this control in webservice. Any suggestion is helpful to me, thank you!
|
|
|
|
|
lynn1007 wrote: I'm trying to wrap this control with webservice, and webservice has many advantages.
You really don't have a clue what a web service is do you?? You've been told, how many times now?, that a web service has no user interface, and as such, you cannot use visual controls on it. There is no point in putting a player in a web service. AT BEST, it'll play whatever on the web server, and only briefly if at all, and not play at all on the client browser side.
IT WILL NOT WORK!! YOU CANNOT USE THESE CONTROLS IN A WEB SERVICE PROJECT!!
|
|
|
|
|
Thanks!
This means that I do not need to spend any more time trying to use the control in web service project. You really do me a big favor. Thank you so much.
I have tried to work this problem, though it didn't and won't come out anything, at least I understood something.
Another question, does it mean that webservice cannot replace activex control totally?
|
|
|
|
|
lynn1007 wrote: does it mean that webservice cannot replace activex control totally?
They are two completely different technologies that have nothing to do with each other. Web Services were never meant to replace ActiveX controls.
|
|
|
|
|
Thank you!
Perhaps I've misuderstood somewhere. I have to read more books.
|
|
|
|
|
It's not the fact that it's a web service that means you cannot do it this way - at least not that alone. Consider the arcitechture of *any* client-server system and you will see (I hope) why it cannot work.
There is a server computer and a client computer. Programs are running in both places, and they have different roles. The client is a program that sends messages we call "requests" to the server program, and the server is a program that accepts such requests and sends a message back called a "response". In other words, from the client's point of view a server cannot provide anything but these messages.
In principle, it would be possible to have a server that responded to a message by sending both *data* and *code* to the client. The code could be precompiled, or it could be text that the client compiles when it receives it. But obviously such a solution would be problematic. It would be potentially very dangerous, unless the client can have absolutely total confidence that it's not possible for anyone to intercept the communication and send evil messages full of virus code.
So basically if you succeeded in running the media player in your service it wouldn't result in anything playing at the client. The usual way of doing this is instead to run the media player on the client side, usually embedded in a web page, and just send video data from the server.
You can google for articles about how to do this, but to be honest I think you should take some time to do simpler stuff first to get a good grasp of the basics as video streaming is a fairly advanced concept.
|
|
|
|
|
Thank you for your reply.
Your reply gives me some hope. That's very kind. I'll keep an eye on the articles about this stuff.
|
|
|
|
|
We are running a .Net 2.0 application on a Windows 2003 server machine with service pack 1.
But the application crashes frequently (say once every 15 min), and following message is logged in event viewer - "Faulting application <app name="">, faulting module mscorwks.dll"
we hv also tried to install the patch from the following link
http://support.microsoft.com/kb/913384[^]
But the problem persists..
Any help on this issue will be highly appreciated.
Thanks in advance
Vikas Salvi
Programmer Analyst
|
|
|
|
|
Im creating a web browser for a friend, and one of his requests is that I should have favourites/bookmarks built in. Im trying to do this by reading and writing to a text file. Can anyone fix my mistakes? This doesnt work at all.
'To load the favourites on startup:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each item As String In "C:/Program Files/Testfile.txt"
ComboBox1.Items.Add(item)
Next
End Sub
'To add the content of a textbox to your favourites
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
texty.Text = WebBrowser1.Url.ToString()
'If My.Settings.Favourites.Contains(texty.Text) Then
' MessageBox.Show("It has been in your favourites!")
'Else
'
ComboBox1.Items.Add(texty.Text)
Dim objStreamWriter As StreamWriter
'Pass the file path and the file name to the StreamWriter constructor.
objStreamWriter = New StreamWriter("C:\Program Files\Testfile.txt")
'Write a line of text.
objStreamWriter.WriteLine(texty.Text)
'Close the file.
objStreamWriter.Close()
'End If
End Sub
Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
WebBrowser1.Navigate(ComboBox1.Text)
End Sub
|
|
|
|
|
britishcolumbia wrote: For Each item As String In "C:/Program Files/Testfile.txt"
You really need to pickup a beginners book on VB.NET and work through it. Just specifying a string in a For Each doesn't automatically assume that string is a file path and open it for reading.
britishcolumbia wrote: Im creating a web browser for a friend
So, why doesn't your friend get a hold of IE8 or FireFox and have a working web browser now, instead of waiting for a couple of months for you to figure out how to write one?? After all, your obviously just wrapping the built-in WebBrowser component, which is just IE anyway.
Seriously, your code is so bad that I don't consider it fixable. I'd scrap it and rewrite it from scratch, using XML to store the Favorites instead of a straight text file.
|
|
|
|
|
Please keep your comments to your self if you don't plan to help anyone.
Everyone starts somwhere, I start here.
If you’re the Microsoft MVP, you most likley know how to fix this. If you would like, without criticizing me, please help me out. If not, good day to you.
|
|
|
|
|
Do you really expect people to spend time and help you with your attitude?
Be smart and recognize good advice when it is offered.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Allright, well I'm going to close this post, Im just used to other forums where that would have been considered "Bad help" but I'm new here, so I suppose things work a little differently.
I guess I took the previous post the wrong way, I thought that saying that the code was so bad that I should just re-write it, and then saying that the whole project was nutty, or worthless as I took it. I don't really see that too much outside of YouTube commenting, and thought it was a bit rude.
I was just looking for a bit of advice. That’s for whatever you gave me, even if I didn’t see it.
|
|
|
|