|
You can use ListBox1.SelectedItems to get collection of selected items and itrate through.
- ashish
|
|
|
|
|
Hi all, I have a webservice which simply takes an XML formatted string and then processes it in the business logic & data layer. The Web Service throws an exception if an attempt is made to create duplicate key row in DB.
However, when I am invoking the webservice's web-method via a C# client, I'm getting timed out by webservice.
Anyways, I have run an extensive tests for all cases and have had no luck trying to pinpoint the error cause/source.
My variables:
Client Type: C# or IE (C# program to call webservice, IE -- opening ASMX page from localhost and using the ASMX page for testing)
Is Duplicate?: false or true (Will the string I'm posting cause dup error?)
String length: small or large (large == 1500+ chars; small == 1186 chars; small is the same data but all of the xml formatting -- indentation -- is removed)
So total of 8 various permutations:
Test Results:
Test 1: (C#, no dup, small): no errors
Test 2: (C#, no dup, large): no errors
Test 3: (C#, dup, small): "duplicate" error captured by C# client in Catch statement
Test 4: (C#, dup, large): timeout error raised (According to SQL Trace, SQL Server has sent error to the called and is not hung)
Test 5: (IE, no dup, small): no errors
Test 6: (IE, no dup, large): no errors
Test 7: (IE, dup, small): "duplicate" error captured by C# client in Catch statement
Test 8: (IE, dup, large): "duplicate" error captured by C# client in Catch statement
Possible causes:
a) Problem w/ the way C# client captures errors: non issue because C# client catches the error in test #3.
b) problem w/ processing dups: not possible since test # 3, 7 & 8 process dups
c) server cannot handle "large" size -- Problem w/ data size: non issue because server does successfully process (or. not timeout) in test #2 & Test 8
Any suggestions/pointers would be greatly appreciated.
Thanks.
- Malhar
|
|
|
|
|
Let me summarise first what I have understood from you message,
I think your are passing the string parameter(XML) to webservice, in-turn which will be calling you BL layer and again it will be inserted through datalayer into DB.
It is correct? are thing i have missed out, let me know.
and I have one question is are you inserting through SP(storedprocedure)?
if so then just pass this string(xml formatted string) parameter to SP and use openxml in sp then insert it through bulk insert statement
Note: Assuming that there is no primarykey in the table or you are not passing any just duplicate data for the PK constraint.
Is that make sense...
Amju
|
|
|
|
|
Yes you're correct.
WS Client (C# / IE) -> C# Web Service -> C# Business Logic -> C# Data Access Layer -> MS SQL 2k DB
The Xml string is passed as string to DB as an xml document. I am using openxml in the SP to parse it the the DB level.
The Xml data I'm passing is for creating a new User. So the UserID in the DB is set to numeric (e.g. auto-numbered). However, the unique constraint is defined by the UserName.
So if I pass "formatted" User Create XML to DB (assuming the username does not already exist), then my entire chain works.
However, if I pass the same "formatted" User Create XML to WS AGAIN (to make sure dup is not created), then my chain from (C# WebService <--> DB) works but c# WS Client <--> WebService fails. The reason why I know the C# WS <--> DB is because, the WS records the "dup" error in the Event Log regardless of the WS client type. But only in the case of C# client, the error for somereason does not get propagated and the c# client get a timeout.
Then again, if I pass the same "UNformatted" User Create Xml to WS, I do get the dup error.
Thanks for your help.
|
|
|
|
|
I'm wondering weather or not there is a utility program out there or one that someone can point me in the general direction to make that can search through an entire PST (msg AND attachments) and generate a file list report and/or a file duplication report to a simple text file.
Thank you in advance.
--Brandon
|
|
|
|
|
I am consistantly receiving a "Parameter is incorrect" Win32Exception as a result of the following code for a keyboard event.
I have tried many different method to get this to work, including using the CopyMemory API, and Marshal.Copy into the destination. No luck.
Any thought?
Public Class SendInput
Private Declare Function SendInput Lib "user32.dll" (ByVal nInputs As Long, ByVal pInputs As INPUT_TYPE_KEYBD, ByVal cbSize As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (ByVal Destination As Object, ByVal Source As Object, ByVal Length As Long)
Private Const INPUT_KEYBOARD As Long = 1
Private Structure KEYBDINPUT
Dim wVk As Long
Dim wScan As Integer
Dim dwFlags As Long
Dim time As Long
Dim dwExtraInfo As Long
End Structure
Private Structure INPUT_TYPE_KEYBD
Dim dwType As Long
Dim xi As KEYBDINPUT
End Structure
Public Sub SendKybdInput(ByVal vk As VirtualKeys, ByVal isUp As Boolean)
Dim inputevents As New INPUT_TYPE_KEYBD ' holds information about each event
With inputevents.xi
.wVk = vk
.wScan = 0 ' not needed
If isUp = True Then
.dwFlags = KEYEVENTF_KEYUP
Else
.dwFlags = 0 ' press the key down
End If
.time = 0 ' use the default
.dwExtraInfo = 0 ' not needed
End With
Dim ret As Long = SendInput(1, inputevents, Marshal.SizeOf(inputevents))
Console.WriteLine("Err 3: " & New Win32Exception().Message)
Console.WriteLine("Response: " & ret)
End Sub
End Class
|
|
|
|
|
May be this will help you out, it sets the num lock,scroll lock and cap lock keys, but it should work with any key added to VirtualKeys.
'------------ Form1.vb ----------------------------------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Check and set the Keyboard NUMLOCK
Dim ret As Boolean = Keyboard.GetState(VirtualKeys.VK_NUMLOCK)
' if it's on, turn it off, if it's off, turn it on
If ret = True Then
Keyboard.SetState(VirtualKeys.VK_NUMLOCK, False)
Else
Keyboard.SetState(VirtualKeys.VK_NUMLOCK, True)
End If
End Sub
'------------ Class1.vb ----------------------------------------------
Imports System
Imports System.Runtime.InteropServices
Public Enum VirtualKeys
VK_NUMLOCK = &H90
VK_SCROLL = &H91
VK_CAPITAL = &H14
End Enum
Class Keyboard
Const KEYEVENTF_EXTENDEDKEY As Int32 = 1
Const KEYEVENTF_KEYUP As Int32 = 2
<DllImport("user32.dll")> _
Shared Function GetKeyState(ByVal nVirtKey As Integer) As Short
End Function
<DllImport("user32.dll")> _
Shared Sub keybd_event(ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Int32, ByVal dwExtraInfo As Int32)
End Sub
Public Shared Function GetState(ByVal Key As VirtualKeys) As Boolean
Return (GetKeyState(CType(Key, Integer)) = 1)
End Function
Public Shared Sub SetState(ByVal Key As VirtualKeys, ByVal State As Boolean)
If Not (State = GetState(Key)) Then
keybd_event(CType(Key, Byte), 69, KEYEVENTF_EXTENDEDKEY Or 0, 0)
keybd_event(CType(Key, Byte), 69, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0)
End If
End Sub
End Class
|
|
|
|
|
hi
i m new to the field of activex and i want to know that are activeX (internet activex) made in the vc or vb are capable of self registering. or had to something extra to
register them. particularly the (internet activex) controll. if not that what functions will be used to register them.
i had made the (internet activex) that play the movie on the page i want to know that when user will visit my page then ocx will be selfdownloaded
and selfrejisted to that client pc. or what will happen.
ddd
|
|
|
|
|
I have a form that has multiple textboxes that a user needs to input data into in order to write to several tables within sql server. All of the controls on the form are data binded to a column within a specific table. I can read from all tables using the (generic) code command:
DataAdapter.Fill(DataSet)
My problem is that I can not update/write to the database. I'm using the (generic) code command: DataAdapter.Update(DataSet), so that when any change is made to any textbox control when the user triggers the click event button to update the database it will update/write to the database using what is currently in the textboxes.
I receive no error messages and my 'CommandText' property under the dataAdapter has the sql code generated to insert a into the proper fields and tables. Any idea(s) why I can not update/write to the sql server?
Language: vb.net 2003
Server: sql server 2000
Shannon P.
|
|
|
|
|
My advice is to write one stored procedure that updates all the appropriate tables. Once you have your stored procedure written call it like this. Also put imports data.sqlclient at the top of your page. This is an example from the project I'm working on, obviously you need to use your own names / variables.
Private Function UpdateLiabilityRecord(ByVal intClassID As Integer)
Dim Conn As New SqlConnection
Conn.ConnectionString = Session("ConnectionString")
Dim Cmd As New SqlCommand
Cmd.Connection = Conn
Cmd.CommandType = CommandType.StoredProcedure
Cmd.CommandText = "dbo.USP_AM_UpdateLiabilityClass"
Dim PrmClassID As New SqlParameter("@ClassID", SqlDbType.Int)
PrmClassID.Direction = ParameterDirection.Input
Cmd.Parameters.Add(PrmClassID)
PrmClassID.Value = intClassID
Dim PrmClassCode As New SqlParameter("@ClassCode", SqlDbType.Char, 6)
PrmClassCode.Direction = ParameterDirection.Input
Cmd.Parameters.Add(PrmClassCode)
PrmClassCode.Value = Right("000000" & Trim(Me.txtClassCode.Text), 6)
Dim PrmEffectiveDate As New SqlParameter("@EffectiveDate", SqlDbType.DateTime)
PrmEffectiveDate.Direction = ParameterDirection.Input
Cmd.Parameters.Add(PrmEffectiveDate)
PrmEffectiveDate.Value = CDate(Me.txtEffDate.Text)
Conn.Open()
Cmd.ExecuteNonQuery()
Conn.Close()
End Function
Of course, don't forget to validate your data first.
"People who never make mistakes, never do anything."
My blog
http://toddsnotsoamazinglife.blogspot.com/
|
|
|
|
|
Hello all,
I am receive an error that a parameter has not been supplied when the page loads, And this error would be correct because it is not to be supplied until a user makes a selection after the page loads.
Here is what i have: I HAVE two data list on one page, one is a menu (a) and the other (b) one populates when the selection has been made; therefore, the error parameter that im getting tells me that the (b) is tring to fire to early.
The way that i have the controls set up is just a simple drag and drop from the solution bar to the page in question. Is there some sort of code that i should add that would keep (b) from tring to fire up early?
Thank you ahead of time.
Erik...
|
|
|
|
|
Yeah add the data to your data list via code not from the designer. Copy the auto generated code to the postback event from the the first list.
"People who never make mistakes, never do anything."
My blog
http://toddsnotsoamazinglife.blogspot.com/
|
|
|
|
|
The way that i am implementing it at this time is i have all of my class files in a seperate folder with the same namespace. and i access the info for the databind via namespace.class ----- dl.datasource = myfunction
and i am getting aggggg with this wall i keep hitting with this error that
(((expects parameter '@IDProduct', which was not supplied. )))
I know the parameter has been passed because i can see it in the address bar, and there is other controls that rely on this ProductID so i know it is making it to the requesting page. What do you think that i am doing wrong here.
Any help at all will be great!
Thank you ahead of time..
erik..
|
|
|
|
|
Hey, I have two forms one w/ a list of Projects and the other w/ a checklist for the project selected from the Project form. I have created a checkbox in the Projects form that is suppose to be checked when a project checklist has been created/started.....how do I go about doing this??
|
|
|
|
|
|
How can pass the Query in CrystalReport
in run time and show the data in CrystalReport
This is the sample query I press the button
that time the the name and Address how to
show in CrystalReport
"select name,Address" from tb_book"
Os: winxp
Report: CrystelReport 9
VB.net
Continue...
|
|
|
|
|
I don't think you can pass the entire query. You can pass parameters to or the crystal reports filter. You can also run a crystal report of an xml file or dataset, but I doubt you can pass the entire query.
"People who never make mistakes, never do anything."
My blog
http://toddsnotsoamazinglife.blogspot.com/
|
|
|
|
|
how do i get infomation from a database using a datagrid using sql
|
|
|
|
|
Which language are you writing this in? J#, C#, VB, etc, what?
Are you using .Net 2003? VB6? Give as much information as possible.
What are you trying to do specifically?
-Nclero
|
|
|
|
|
Nclero wrote:
Which language are you writing this in?
i suppose it is in VB as we are currently talking on the VB Forum
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
search the MSDN for SQLDataAdapter ... this class provides good functions to work with ADO, but of course, with MS SQL Server too...
what RDB do you query on ?
what language do you use also, VB6 or VB.NET ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
search MSDN by keywords "ADO.NET" ,there are lots of samples tell us how to do so
Today is a gift, that's why we call it present
|
|
|
|
|
how do i display infomation from two different tables created in access on a data grid using VB 6.0
how do i also add and remove infomation froma a datagrid that is from a VB 6.0 interface and at the same time update the da:-Dtabase
|
|
|
|
|
Have you ever taken a look at the MSDN?
Try www.msdn.com and ask your question in there - not to brush you off or anything, but they can answer your question with a greater level of detail and you'll get more out of it that way.
Trust me, as a programmer myself, the MSDN and I have gotten very close over the years.
-Nclero
|
|
|
|
|
I am making my own version of a media player. The progress is going great except that the DS control (msvidctl.dll) will not play MPEG-2 files. I thought that the control would handle this automatically. MSDN says that we need to specifiy the MPEG-2 Demuxer and other stuff. Could anyone please post some sample code (VB would be prefered, but otherwise I can join the peices from other languages). I am not using Microsoft.DirectX.AudioVideoPlayback.dll, even thought it works great I cannot combine this assembly with anyother dll using ILMerge.
I have also built a DVD application using the same dll, the only help I need is figure out how to control the dvd navigation filter. At the moment I use
DScontrol.view("DVD:")
This snippet will allow me to play dvds but I cannot control which drive I want to play i.e. If I have 2 drives with dvd movies in the them, the drive that has the master setting on the IDE bus or lower drive letter(dont remember which one of the 2) will play everytime. If I eject one of them, the other one will play. Does anyone know how I can command a specific drive to play a dvd movie? Your help is greatly appreciated.
Thanks
|
|
|
|