|
thecodeprojectPankaj wrote: SqlDataAdapter dr = cmd.ExecuteReader();
There's your problem. You should use this as a SqlDataReader instead.
SqlDataReader dr = cmd.ExecuteReader(); BTW - you have quite a few resource issues here - you have resources which need disposing which you haven't, you haven't closed your connection anywhere.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
|
Using .NET 3.5, SQL Server 2005 and C# 2008 Express.
Server creates instances of the server-side code.
Worked fine under XP. Upgraded to Windows 7 and the remote calls hang.
If I add code to my client which accesses the database directly (inserted before it does the remote call, it works. But not remotely through the server.
Is there something I should know about SQL Server/.NET/Windows 7?
|
|
|
|
|
The information you provided is not enough. What is your app doing and where does it hang ? And what does remote call mean, WCF, Web Service or a remoting component ?
|
|
|
|
|
Not clued up on terminology, so will give examples.
The first step that the app does is collect the username and logon, and then check if they are in the database.
I am using interfaces to the server-side code, and the server creates instances of the code like this
UserList insUserList = UserList.Instance;
ObjRef refUserList = RemotingServices.Marshal(insUserList, "UserList");
The client does a call like this
private IUserList rmUserList;
rmUserList = (IUserList)Activator.GetObject
(typeof(IUserList),
System.Configuration.ConfigurationManager.AppSettings["UserListUrl"]);
logonReturnValue = rmAllUserList.Logon(PasswordString);
UserListUrl is tcp://localhost:50050/UserList
On the server side it does (through calls to a pool of common routines, also on the server.
cnStr = "Data Source='NIGEL-PC\\SQLEXPRESS';" +
"Trusted_Connection=true;" +
"Database=timesheet";
cn = new SqlConnection(cnStr);
cmd = new SqlCommand("", cn);
da = new SqlDataAdapter();
cmd.CommandText = "SELECT Password " +
"FROM UserList " +
"WHERE UserID = 12 ";
da.SelectCommand = cmd;
tmpDS = new DataSet();
da.Fill(tmpDS, "Data");
If I run the above code snippet in ClientLogon it works. If I allow it to do the remote call, it hangs.
|
|
|
|
|
More info:
On the server side, I created a routine that only returns a string "OK", with no data access. Still hangs, so it is definitely the remoting bit, not the data access.
|
|
|
|
|
If anyone is interested, the problem was with Comodo Internet Security, even when diasabled.
|
|
|
|
|
gud morning friends
when i run my aaplication in vs 2005
i get the message
" unable to connect to vs local host web server "
i searched i foun d that thers a file callede webdev.webserver.exe
and i deleted it and copied from another system
it worked fine but only 1 time
now the same problem is occuring again
plz. do help
|
|
|
|
|
Probably you'll need to redelete and recopy every programming session.
|
|
|
|
|
Can't find it using search.
I can generate the .snk file using sn.exe -k. But I have forgotten how to generate the .pfx file. I upgraded to Windows 7 so of course I have lost it, and now when I compile I have to supply the password for every file in my solution!!
|
|
|
|
|
Hi,
I had the same problem and as far as I remember, I created a new pfx with the same name + known password and replaced it.
|
|
|
|
|
That is exactly my problem - how do I create the pfx file?
|
|
|
|
|
Create a new project (a dummy one) in the project properties go to the signing tab, click sign this assembly, under the choose name key label, select new from the combo box and create it. There is a manual way to make it from command line but right now, I can only trace back this one.
|
|
|
|
|
I am starting to remember now. And then you say "Password protect it". Ta.
|
|
|
|
|
hi
i used the following code..
-------------------------------------------------------
Microsoft.Office.Interop.Word.ApplicationClass wordApplication = new ApplicationClass();
object o_nullobject = System.Reflection.Missing.Value;
object o_filePath = "C:\\bok_doc.docx";
object o_format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatHTML;
object o_encoding = Microsoft.Office.Core.MsoEncoding.msoEncodingUTF8;
object o_endings = Microsoft.Office.Interop.Word.WdLineEndingType.wdCRLF;
object o_Readonly = true;
Microsoft.Office.Interop.Word.Document doc = wordApplication.Documents.Open(ref o_filePath,
ref o_nullobject, ref o_Readonly, ref o_nullobject, ref o_nullobject, ref o_nullobject,
ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject, ref o_nullobject,
ref o_nullobject, ref o_nullobject);
Microsoft.Office.Interop.Word.Document doc1 = wordApplication.ActiveDocument;
string m_Content = doc1.Content.Text;
// sp.InnerHtml = m_Content;
// the content is stored into the textbox.
//TextBox1.RenderControl(
TextBox1.Text = m_Content;
------------------------------------------------------------------------------------------------------
it work fine for me but it does not carry the formating done in the ms-word , it shows all the content in the plain text ... can any body please help me out , in order to show the content in the same format as it was in word (docx)
vimal kumar
System Engineer
Infosys,Mysore,India.
|
|
|
|
|
Print the Word doc on the fly to an XPS document, and then load the XPS document into a WPF DocumentViewer control in a WPF window or host the Viewer in a Windows Form.
|
|
|
|
|
hi
would you please provide me the detail to how i can resolve the problem..
since i had never used the XPS format ..
and how i will be reading that format using asp.net (C#)..
to display the content in the textbox.
regard
vimal
|
|
|
|
|
You didn't mention that you were using ASP.NET in your original question.
Since that's the case, just open the Word document in an new IE Window and forget about using a control. XPS documents can be opened in IE also; so, no difference in that case.
(And I said to use a "DocumentViewer" control for XPS; not a TextBox. In any case, a DocumentViewer can only be hosted in Windows).
|
|
|
|
|
vimalkumarsinghal wrote: it work fine for me but it does not carry the formating done in the ms-word , it shows all the content in the plain text
Of course it doesn't work! First of all, the TextBox control doesn't know anything about Word formatting and cannot render what it doesn't know how to do. Second, you're getting only the text from the Word document, not the formatting.
Basically, you can't do what you want using a TextBox control.
|
|
|
|
|
Save the word document as RTF and use RichTextBox to display the content.
|
|
|
|
|
hi
Do we have the richtextbox control in asp.net 3.5..
would you please guide me the way i can achieve this..
regard
vimal
|
|
|
|
|
I was talking about Windows Application. There is no way (as far as I know) where you can interactively display Word document on a web page.
You may try to convert the Word doc into html format and display it in an iFrame.
|
|
|
|
|
hello to everyone.. i want to ask how to do this code in vb.net.. becuase i am newly in the vb.net .. i only got correctly in vb6.. there are some differences but i think their almost the same.. can you help me guys to do my program..?? my problem is that i cant generate the voice... it gives me error but in vb6 its working properly.. i am using now vb.net and sapi 5.1.. my OS windows XP.. this is like an ordering application..
here's my code...
Public Class main<br />
<br />
Public gmode As Integer<br />
Public gRestoreGrammar As Boolean<br />
Public additional As Boolean<br />
<br />
Private Sub AxDirectSR1_PhraseFinish(ByVal flags As Long, ByVal beginhi As Long, ByVal beginlo As Long, ByVal endhi As Long, ByVal endlo As Long, ByVal Phrase As String, ByVal parsed As String, ByVal results As Long)<br />
If (parsed = "") Then<br />
AxDirectSR1.Deactivate()<br />
If (Rnd() > 0.5) Then<br />
AxDirectSS1.Speak("kindly repeat your order again sir.")<br />
Else<br />
AxDirectSS1.Speak("please follow the menu.")<br />
End If<br />
Else<br />
If (parsed = "ok") Then<br />
AxDirectSR1.Deactivate()<br />
If (additional = False) Then<br />
gmode = 2<br />
AxDirectSS1.Speak("Would like to have drinks?")<br />
<br />
Else<br />
gmode = 3<br />
AxDirectSS1.Speak("would that be all sir?")<br />
End If<br />
ElseIf (parsed = "cancel") Then<br />
Dim Item As String<br />
Item = ListBox1.Items.Count - 1<br />
If (Item >= 0) Then<br />
ListBox1.Items.Remove(ListBox1.Items.Count - 1)<br />
AxDirectSR1.Deactivate()<br />
AxDirectSS1.Speak("your order cancel")<br />
End If<br />
ElseIf (parsed = "no") Then<br />
If (gmode = 2) Then<br />
gmode = 3<br />
additional = True<br />
AxDirectSR1.Deactivate()<br />
AxDirectSS1.Speak("verifying your order")<br />
ElseIf (gmode = 3) Then<br />
gmode = 0<br />
gRestoreGrammar = True<br />
AxDirectSR1.Deactivate()<br />
AxDirectSS1.Speak("you can continue your order")<br />
Else<br />
gmode = 0<br />
gRestoreGrammar = True<br />
End If<br />
ElseIf (parsed = "yes") Then<br />
<br />
If (gmode = 2) Then<br />
'form2.Show()<br />
gmode = 3<br />
AxDirectSR1.Deactivate()<br />
AxDirectSS1.Speak("would that be all")<br />
<br />
ElseIf (gmode = 3) Then<br />
Dim total As Integer<br />
total = 0<br />
For i = 0 To ListBox1.Items.Count - 1<br />
total = total + Val(ListBox1.Items(i))<br />
Next i<br />
ListBox1.Items.Add("---total is: $" + Format(total, "###0.00"))<br />
gmode = 1<br />
gRestoreGrammar = True<br />
<br />
AxDirectSR1.Deactivate()<br />
<br />
AxDirectSS1.Speak("Your total will be $" + Format(total, "###0.00") + " at the next window please.")<br />
End If<br />
Else<br />
AxDirectSR1.Deactivate()<br />
ListBox1.Items.Add(parsed)<br />
End If<br />
End If<br />
<br />
ListBox1.SelectedIndex = ListBox1.Items.Count - 1<br />
AxDirectSS1.Speak(Phrase)<br />
<br />
End Sub<br />
Private Sub DirectSS1_AudioStop(ByVal hi As Long, ByVal lo As Long)<br />
If (gmode = 1) Then<br />
ListBox1.Items.Clear()<br />
gmode = 0<br />
AxDirectSS1.Speak("Hi! May I take your order?")<br />
Else<br />
If (gmode = 2) Or (gmode = 3) Then<br />
<br />
AxDirectSR1.GrammarFromFile("C:\Documents and Settings\kaex21\My Documents\Visual Studio 2008\Projects\Project1\WindowsApplication6\WindowsApplication6\yesno.txt")<br />
<br />
ElseIf (gRestoreGrammar) Then<br />
<br />
AxDirectSR1.GrammarFromFile("C:\Documents and Settings\kaex21\My Documents\Visual Studio 2008\Projects\Project1\WindowsApplication6\WindowsApplication6\menu.txt")<br />
gRestoreGrammar = False<br />
<br />
End If<br />
REM we had to turn off listening before talking, so now that we are done talking we<br />
REM should start listening again<br />
AxDirectSR1.Activate()<br />
End If<br />
End Sub<br />
<br />
Private Sub main_Terminate()<br />
AxDirectSR1.Deactivate()<br />
End Sub<br />
<br />
<br />
<br />
Private Sub LinkLabel2_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked<br />
Form5.Show()<br />
Visible = False<br />
<br />
End Sub<br />
<br />
Private Sub Label9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label9.Click<br />
<br />
End Sub<br />
<br />
Private Sub GroupBox18_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox18.Enter<br />
<br />
End Sub<br />
<br />
Private Sub LinkLabel3_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel3.LinkClicked<br />
End<br />
End Sub<br />
<br />
<br />
Private Sub main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
gmode = 0<br />
gRestoreGrammar = False<br />
<br />
On Error GoTo GeneralFail<br />
REM we just use this function once, on the first callback, then the timer isn't needed anymore<br />
Dim engine<br />
REM Initialize the recognizer. We want command and control, so find and select that engine (or best match)<br />
AxDirectSR1.Initialized = 1<br />
<br />
engine = AxDirectSR1.Find("MfgName=Microsoft;Grammars=1")<br />
AxDirectSR1.Select(engine)<br />
<br />
REM Burger.txt is our uncompiled grammar. Compile and load it now.<br />
AxDirectSR1.GrammarFromFile("C:\Documents and Settings\kaex21\My Documents\Visual Studio 2008\Projects\Project1\WindowsApplication6\WindowsApplication6\menu.txt")<br />
REM Now load the synthesizer, find and select any female voice from microsoft<br />
AxDirectSS1.Select(AxDirectSS1.Find("MfgName=Microsoft;Gender=1"))<br />
<br />
REM Start the voice interface...control goes to DirectSS1_AudioStop after this is said, gMode=0<br />
AxDirectSS1.Speak("Welcome to kaex restaurant, sit back and enjoy as you take your order.")<br />
<br />
REM sometimes the vb environment comes to front while we're loading, so take the screen back<br />
Me.Show()<br />
GoTo done<br />
GeneralFail:<br />
MsgBox("Unable to start using text to speech or recognition.")<br />
done:<br />
<br />
End Sub<br />
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br />
<br />
End Sub<br />
<br />
End Class
|
|
|
|
|
Its quite difficult to write down the full code, but if you can tell us what error you are getting then we may help you.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
 sorry for putting down all my codes..
here's the line of code which ive got error..
Private Sub main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load <br />
gmode = 0<br />
gRestoreGrammar = False<br />
<br />
On Error GoTo GeneralFail<br />
<br />
REM Initialize the recognizer. We want command and control, so find and select that engine (or best match)<br />
AxDirectSR1.Initialized = 1<br />
dim engine as string<br />
engine = AxDirectSR1.Find("MfgName=Microsoft;Grammars=1")<br />
AxDirectSR1.Select(engine)<br />
<br />
REM menu.txt is our uncompiled grammar. Compile and load it now.<br />
<br />
AxDirectSR1.GrammarFromFile("C:\Documents and Settings\kaex21\My Documents\Visual Studio 2008\Projects\Project1\WindowsApplication6\WindowsApplication6\menu.txt")<br />
REM Now load the synthesizer, find and select any female voice from microsoft<br />
AxDirectSS1.Select(AxDirectSS1.Find("MfgName=Microsoft;Gender=1"))<br />
<br />
REM Start the voice interface...control goes to DirectSS1_AudioStop after this is said, gMode=0<br />
AxDirectSS1.Speak("Welcome to kaex restaurant, sit back and enjoy as you take your order.")<br />
<br />
REM sometimes the vb environment comes to front while we're loading, so take the screen back<br />
Me.Show()<br />
GoTo done<br />
GeneralFail:<br />
MsgBox("Unable to start using text to speech or recognition.")<br />
done:<br />
<br />
End Sub
it always say "unable to start using text to speech or recognition becuase it has an error.. and directly it go to generalfail.. it means i have an error above my codes.. can you help me sir how to correct this one?? in newly in vb.net.. this code that ive been working is fully functional in vb6.. but in vb.net is not..
|
|
|
|