|
Check into Microsoft's Media Encoder 9.0 SDK. It'll let you setup and broadcast audio and video. The client's will, of course, have to be running Media Player and connect to the URL exposed by your audio server to connect to.
|
|
|
|
|
Hello,
I have a vb.net application that runs on a server. There are five client PC's that are connected to the server and all the data is saved on the server from my vb.net application.
To add a record, two sql runs under Commit transaction. One runs an insert statement while the other updates a record.
However, I have noticed a error. The update statement has lot of other fields which are stored correctly, but sometimes (say one out of 100 record) it doesnt stores the correct value to a numeric field. This field is integer and the data is stored from a text box.
This is creating a lot of trouble in my application. Please help.
|
|
|
|
|
That description isn't specific enough to solve your problem. You are going to have to do some digging around in your application before we can help you.
Have you stepped through the code? Have you checked the values going to the database? Have you parsed the text box correctly? Can you recreate the scenario in which the value is wrong? If not, what investigations have you done to determine what the scenarios the number is wrong?
|
|
|
|
|
Hill all
I thought it would be the right place to post this Question in this Forum. Because its a lot Problems on VB than SQL. i have a Problem with one of my Parameters. i have the Following Procedure.
<br />
USE [ValRollClients]<br />
GO<br />
<br />
SET ANSI_NULLS ON<br />
GO<br />
SET QUOTED_IDENTIFIER ON<br />
GO<br />
ALTER Proc [dbo].[Save_Client] <br />
(<br />
--Carry Original values before Update<br />
@Original_Client_ID int,<br />
@Original_Client_Name varchar(50),<br />
@Original_Contact_Person varchar(20),<br />
@Original_Purchase_date datetime,<br />
@Original_Client_Address varchar(50),<br />
@Original_Client_Telephone varchar(20),<br />
@Original_Client_Cell_No varchar(20),<br />
@Original_SerialNumber varchar(20),<br />
@Original_Product_Status int,<br />
@Original_Client_Email varchar(30),<br />
--Carry values after the update has been done<br />
<br />
@Client_Name varchar(50),<br />
@Contact_Person varchar(20),<br />
@Purchase_date datetime,<br />
@Client_Address varchar(50),<br />
@Client_Telephone varchar(20),<br />
@Client_Cell_No varchar(20),<br />
@SerialNumber varchar(20),<br />
@Product_Status int,<br />
@Client_Email varchar(30)<br />
)<br />
as<br />
Update Clients set<br />
Client_Name = @Client_Name,<br />
Contact_Person = @Contact_Person,<br />
Purchase_date = @Purchase_date,<br />
Client_Address = @Client_Address,<br />
Client_Telephone = @Client_Telephone,<br />
Client_Cell_No = @Client_Cell_No,<br />
SerialNumber = @SerialNumber,<br />
Product_Status = @Product_Status,<br />
Client_Email = @Client_Email<br />
Where<br />
(Client_ID = @Original_Client_ID)<br />
And<br />
(Client_Name = @Original_Client_Name or <br />
@Original_Client_Name IS NUll AND Client_Name Is Null)<br />
And <br />
(Contact_Person = @Original_Contact_Person or <br />
@Original_Contact_Person Is Null And Contact_Person IS Null)<br />
And<br />
(Purchase_Date = @Original_Purchase_date or <br />
@Original_Purchase_date is Null And Purchase_date Is Null)<br />
And <br />
(Client_Address = @Original_Client_Address OR <br />
@Original_Client_Address IS Null And Client_Address is Null)<br />
And<br />
(Client_Telephone = @Original_Client_Telephone OR <br />
@Original_Client_Telephone Is Null And Client_Telephone Is Null)<br />
And <br />
(Client_Cell_No = @Original_Client_Cell_No OR <br />
@Original_Client_Cell_No Is Null And Client_Cell_No IS Null) <br />
And<br />
(SerialNumber = @Original_SerialNumber Or <br />
@Original_SerialNumber is NUll And SerialNumber Is Null)<br />
And<br />
(Product_Status = @Original_Product_Status Or<br />
@Original_Product_Status Is NUll And Product_Status Is Null)<br />
ANd<br />
(Client_Email = @Original_Client_Email Or <br />
@Original_Client_Email is Null And Client_Email Is Null)<br />
<br />
--refreshing the data <br />
;select Client_ID,Client_Name,Contact_Person,Purchase_date,<br />
Client_Address,Client_Telephone,Client_Cell_No,SerialNumber,<br />
Product_Status,<br />
Client_Email <br />
from Clients<br />
Where (Client_ID = @Original_Client_ID)<br />
<br />
<br />
And am Calling the Procedure in vb.net like this
<br />
cmdupdate.CommandText = "Save_Client"<br />
<br />
cmdupdate.CommandTimeout = 0<br />
<br />
cmdupdate.CommandType = CommandType.StoredProcedure<br />
<br />
cmdupdate.Connection = con<br />
<br />
cmdupdate.Parameters.Add("@Client_Name", SqlDbType.VarChar, 50, "Client_Name")<br />
<br />
cmdupdate.Parameters.Add("@Contact_Person", SqlDbType.VarChar, 20, "Contact_Person")<br />
<br />
cmdupdate.Parameters.Add("@Purchase_date", SqlDbType.DateTime, 8, "Purchase_Date")<br />
<br />
cmdupdate.Parameters.Add("@Client_Address", SqlDbType.VarChar, 50, "Client_Address")<br />
<br />
cmdupdate.Parameters.Add("@Client_Telephone", SqlDbType.VarChar, 20, "Client_Telephone")<br />
<br />
cmdupdate.Parameters.Add("@Client_Cell_No", SqlDbType.VarChar, 20, "Client_Cell_No")<br />
<br />
cmdupdate.Parameters.Add("@SerialNumber", SqlDbType.VarChar, 20, "SerialNumber")<br />
<br />
cmdupdate.Parameters.Add("@Product_Status", SqlDbType.VarChar, 4, "Product_Status")<br />
<br />
cmdupdate.Parameters.Add("@Client_Email", SqlDbType.VarChar, 30, "Client_Email")<br />
<br />
<br />
da = New SqlDataAdapter<br />
<br />
da.UpdateCommand = cmdupdate<br />
<br />
Dim prmClient_ID As SqlParameter = cmdupdate.Parameters.Add("@Original_Client_ID", _<br />
SqlDbType.Int, 50, "Client_ID")<br />
<br />
prmClient_ID.SourceVersion = DataRowVersion.Original<br />
<br />
Dim prmClient_Name As SqlParameter = cmdupdate.Parameters.Add("@Original_Client_Name", _<br />
SqlDbType.VarChar, 50, "Client_Name")<br />
<br />
prmClient_Name.SourceVersion = DataRowVersion.Original<br />
<br />
Dim prmContact_Person As SqlParameter = cmdupdate.Parameters.Add("@Original_Contact_Person", _<br />
SqlDbType.VarChar, 50, "Contact_Person")<br />
<br />
prmContact_Person.SourceVersion = DataRowVersion.Original<br />
<br />
<br />
Dim prmPurchase_Date As SqlParameter = cmdupdate.Parameters.Add("@Original_Purchase_date", _<br />
SqlDbType.DateTime, 8, "Purchase_Date")<br />
<br />
<br />
prmPurchase_Date.SourceVersion = DataRowVersion.Original<br />
<br />
<br />
Dim prmClient_Address As SqlParameter = cmdupdate.Parameters.Add("@Original_Client_Address", _<br />
SqlDbType.VarChar, 50, "Client_Address")<br />
<br />
prmClient_Address.SourceVersion = DataRowVersion.Original<br />
<br />
<br />
Dim prmClient_telephone As SqlParameter = cmdupdate.Parameters.Add("@Original_Client_Telephone", _<br />
SqlDbType.VarChar, 20, "Client_Telephone")<br />
<br />
prmClient_telephone.SourceVersion = DataRowVersion.Original<br />
<br />
<br />
Dim prmClient_Cell_No As SqlParameter = cmdupdate.Parameters.Add("@Original_Client_Cell_No", _<br />
SqlDbType.VarChar, 20, "Client_Cell_No")<br />
<br />
prmClient_Cell_No.SourceVersion = DataRowVersion.Original<br />
<br />
<br />
Dim prmSerialNumber As SqlParameter = cmdupdate.Parameters.Add("@Original_SerialNumber", _<br />
SqlDbType.VarChar, 20, "SerialNumber")<br />
<br />
prmSerialNumber.SourceVersion = DataRowVersion.Original<br />
<br />
<br />
Dim prmProduct_Status As SqlParameter = cmdupdate.Parameters.Add("@Original_Product_Status", _<br />
SqlDbType.Int, 4, "Product_Status")<br />
<br />
prmProduct_Status.SourceVersion = DataRowVersion.Original<br />
<br />
Dim prmClient_Email As SqlParameter = cmdupdate.Parameters.Add("@Original_Client_Email", _<br />
SqlDbType.VarChar, 20, "Client_Email")<br />
<br />
prmClient_Email.SourceVersion = DataRowVersion.Original<br />
<br />
<br />
Try<br />
con.Open()<br />
<br />
<br />
da.Update(dsdata)<br />
<br />
con.Close()<br />
<br />
Catch ex As SqlClient.SqlException<br />
<br />
MsgBox(ex.Message)<br />
<br />
End Try<br />
<br />
<br />
<br />
i get an Error when i try to save "Concurency violation:The UodatedCommand Affected 0 records"
What is Wrong with my code
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
A concurrency error (0 rows affected) problem occurs because the data that is used to uniquely identify the record that's being updated no longer (or never did) match the data in the database. Since no record matched the WHERE clause, no update was performed.
Check your code for what you're passing into the SQL stored proc and check the stored proc to make sure it's doing exactly what it should be.
|
|
|
|
|
Good Afternoon Dave
The Problem was the Dimension of the Parameters that i created from the Dimension of the Parameters of the stored procedure and that were created out of gauss work from my mind, that does not match the field from the table. from this i learned that the size of the Field from the table, must apply even down when you create parameters in vb.net,they must remain constant.
Thanks DAVE
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
hi all,
when i copy the contents of word file to rich text box , then formatting is not proper shown . Specially if word file contains table structure or Graphic.
anybody have idea that how can i preserve formatting of word file in richtextbox ?
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Didn't I answer this yesterday ? If a rch text box was as rich as Word, there would be no market for Word.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
How about if you save as RTF from Word then open it in a rich text box?
|
|
|
|
|
if save as RTF then works well. but i give facility to user to copy some part of word file and paste in richtextbox.
so problem is that check format of data to be copied in richtext box.
have any idea about this thing?
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
My Company
|
|
|
|
|
Rupesh Kumar Swami wrote: when i copy the contents of word file to rich text box , then formatting is not proper shown .
Of course not. The RTB doesn't support everything Word does, including formatting options. You're not going to be able to "force" this to work using the RichTextBox.
|
|
|
|
|
Hi guys,
I have a program using databindings bound to a dataset. Dataset sizes vary from 2000 - 10000 rows, but form loads are very slow (when filling the datasets etc).
Does anyone have some suggestions on how to speed it up? Would it be quicker to use certain datasets instead of the WHOLE dataset of the db every time? (for example only declaring and using CRMDataset.Organisation instead of just declaring CRMDataset).
Any other ideas? I need to shave a second or 2 off the form load times.
Thanx in advance
Ed
Private Sub ManageContacts_M_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Try<br />
Me.OrganisationTableAdapter.FillWithFullName(Me.CRMDataSet.Organisation)<br />
Me.Vw_ContactsCoursesTableAdapter.Fill(Me.CRMDataSet.vw_ContactsCourses)<br />
Me.ContactTableAdapter.Fill(Me.CRMDataSet.Contact)<br />
Me.Controls.Add(Me.BindingNavigator1)<br />
<br />
'Get distinct list to populate combobox/autocomplete box<br />
Try<br />
For Each dr As DataRow In DH.RunQuery("Select DISTINCT Title FROM Contact WHERE Title <> '' AND Title IS NOT NULL ORDER BY Title ASC").Tables(0).Rows<br />
Me.TitleComboBox.Items.Add(dr("Title"))<br />
Next<br />
Catch<br />
MessageBox.Show("Could not pre-populate comboboxes")<br />
'EHC.HandleError(Err, Me)<br />
End Try<br />
Me.OrganisationBindingSource.Sort = "OrganisationName ASC"<br />
DS = DH.RunQuery("Select * FROM Users WHERE Username = '" + SystemInformation.UserName + "'") 'Gets user access rights<br />
If DS.Tables(0).Rows(0).Item("TrainingAccess") = "True" Then 'Disables button if user does not have access<br />
Me.Button2.Visible = True<br />
Else<br />
Me.Button2.Visible = False<br />
End If<br />
<br />
Me.Vw_ContactsCoursesBindingSource1.Sort = "StartDate ASC"<br />
Me.OrganisationBindingSource.Sort = "FullName ASC"<br />
Me.OrganisationBindingSource.CancelEdit() 'For some reason certain user pcs require this to be reset.<br />
Me.ContactBindingSource.CancelEdit()<br />
Me.Vw_ContactsCoursesBindingSource1.CancelEdit()<br />
Catch err As Exception<br />
Dim EHC As New ErrorHandlerClass<br />
EHC.HandleError(err, Me)<br />
End Try<br />
End Sub
modified on Tuesday, February 19, 2008 3:08 AM
|
|
|
|
|
Gr1mR33p3r wrote: Dataset sizes vary from 2000 - 10000 rows, but form loads are very slow (when filling the datasets etc).
Gr1mR33p3r wrote: Does anyone have some suggestions on how to speed it up?
Simple. Don't retrieve thousands of rows from the database if you're not going to need them frequently.
Retrieve only the columns from only the rows you need to get a form setup. If you only need 30 rows from a table, why retrieve 15,000 of them? This is probably going to require you rewriting a considerable chunk of your data code.
Gr1mR33p3r wrote: DS = DH.RunQuery("Select * FROM Users WHERE Username = '" + SystemInformation.UserName + "'") 'Gets user access rights
If DS.Tables(0).Rows(0).Item("TrainingAccess") = "True" Then 'Disables button if user does not have access
Here's an example of retrieving too much information. You're using "SELECT *" which returns all the columns for the rows specified, but you're only looking at the value of a single column and discarding the rest. Change the SQL to retrieve only that column.
SELECT TrainingAccess FROM Users WHERE Username=...
I would also highly suggest looking into using parameterized queries instead of building them with string concantenation. You're opening youreself up to SQL Injection attacks and well as making your code harder to debug using the methods you are now. Read[^]
|
|
|
|
|
When my program loads there are 3 different main panels. The first panel that comes up at runtime has a tab control on it. The first page of the tab control has a data grid that holds a weekly schedule and the second page holds an editable teacher profile.
When the program first comes up I need this dataGrid to automatically load with data. How do I load the dataGrid with data on program start up and change the schedule when a different teacher is selected?
There is also another panel that has a list box on it. The list box holds the names of different teachers. When a user clicks on the teacher name in the list box the schedule for that teacher on the first page of the tab control is supposed to load into the data grid, but it does not. Also, at program start-up the schedule for the first teacher in the list box is supposed to load into the data grid.
Being this program has several panels that each contain at least one form how should I go about loading the forms on the panels. Should I load a function for each panel when the panel comes up or should I call the function or sub procedure in the main loop of the program.
|
|
|
|
|
The tabcontrol is kind of irrelevant, you load the data at load in the form load event. You change the schedule by handling the event where the selected teacher is changed, from whatever control shows it.
You say what is 'supposed' to happen, what code have you written to make it happen ? Have you set breakpoints to see if the code executes ?
I would initialise the different views on startup, so there is no delay when the user goes between tabs.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
what do you mean by breakpoints?
|
|
|
|
|
I recommend buying a beginner book on VB.NET and working through it. A breakpoint is what you set so the debugger stops on a line of code, to allow you to examine program flow.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Here's what I'm trying to do:
- Write a VB.NET app which will set a specific service to automatically start if it's not already. I know that there's an article on codeproject.com on how to do this in C#, but either I cannot translate it, or there's something else going on.
(Here's the link to the codeproject.com article: http://www.codeproject.com/KB/system/extendservicecontroller.aspx#WMIArch[^]
Anyway, here's my code:
Dim path As String
Dim result As Integer
path = "\\" + Me.MachineName + "\root\cimv2:Win32_Service.Name=""" + Me.ServiceName + """"
Dim ManagementObj As New ManagementObject(path)
Dim Parameters(1) As Object
Parameters(0) = value.ToString()
Try
result = ManagementObj.InvokeMethod("ChangeStartMode", Parameters)
Catch ex As Exception
MessageBox.Show("Error Changing Start Mode", result.ToString(), MessageBoxButtons.OK)
End Try
...and it's not working. I don't know how to see the result code that ChangeStartMode is returning.
TIA for any help rendered.
-MC-
|
|
|
|
|
Hey Guys,
I found an article that helped me nest a datagridview within a datagridview; however, the nested datagridview doesn't scroll. I was wondering if someone could tell me what I'm missing. Here is my code, which works great when the datacolumn is frozen.
Dim dt As New DataTable
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sql As String = "SELECT distinct upc,sku,style,class_id,department,vendor FROM items a"
Dim adapter As New Odbc.OdbcDataAdapter(sql, New Odbc.OdbcConnection("DSN=tdprod;uid=ccotton;pwd=ccotton"))
If Not dt.Columns.Contains("upc") Then dt.Columns.Add("upc")
If Not dt.Columns.Contains("sku") Then dt.Columns.Add("sku")
If Not dt.Columns.Contains("style") Then dt.Columns.Add("style")
If Not dt.Columns.Contains("class_id") Then dt.Columns.Add("class_id")
If Not dt.Columns.Contains("department") Then dt.Columns.Add("department")
If Not dt.Columns.Contains("vendor") Then dt.Columns.Add("vendor")
adapter.Fill(dt)
DataGridView1.DataSource = dt
DataGridView1.Columns("upc").Frozen = True
DataGridView1.Columns("sku").Frozen = True
DataGridView1.Columns("style").Frozen = True
DataGridView1.ReadOnly = True
End Sub
Private Sub DataGridView1_CellPainting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) Handles DataGridView1.CellPainting
If e.RowIndex >= 0 Then
If e.ColumnIndex >= 0 Then
If e.ColumnIndex = 2 Then
Dim list As New DataGridView
list.ReadOnly = True
Dim helpdt As New DataTable
helpdt.Columns.Add("Num")
For i As Integer = 0 To 8
Dim sub_row As DataRow = helpdt.NewRow
sub_row.Item("Num") = i + 1
helpdt.Rows.Add(sub_row)
Next
list.DataSource = helpdt
DataGridView1.Rows(e.RowIndex).Height = 100
DataGridView1.Columns(e.ColumnIndex).Width = 200
list.Width = 200
list.Height = 100
DataGridView1.Controls.Add(list)
Dim rect As Rectangle = DataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, False)
list.Location = rect.Location
End If
End If
End If
End Sub
Any help would be greatly appreciated.
Thanks.
|
|
|
|
|
has anyone here used DB2Connect to call a DB2 stored procedure. I'm having trouble registering the input/output parameters.
|
|
|
|
|
Hi everyone...
I am working on a game project in VB.NET and flash 8, which requires data stored in an ORACLE database to be retrieved on the flash interface...
I tried to integrate ORACLE and flash, but it seems like an improbable outcome, so i tried sending data from flash to VB.NET and then from the front end to the back end. Apparently, I m stuck!
Can anyone help me find a way to integrate flash 8 to VB.NET or directly to the ORACLE database. Basically i need to retrieve the scores saved on the database to the .swf file
Thanks a lot
|
|
|
|
|
Your best source of information is going to be Adobe's support and/or community forums. What you're asking is very specific to the Flash Player.
But, AFAIK, you can't do what your asking about, though my experience with Flash is very limited.
|
|
|
|
|
Hello I have a little problem that has been really bugging me.
I have a program that I made that retrieves a database table from oracle. The program allows the user to insert and update the database. These functions work great. My problem is that I can not get the delete to work because the table doesn't have a primary key defined. I am not able to change the structure of the table by adding a primary key but I would like to add the primary key in my code.
what is the syntax to add a primary key in vb. My primary key will need to be a compound key that consists of the following three columns "GROUP_NAME", "ENTITY_TYPE", "DESCRIPTION.
I am lost this is what i tried but doesnt work:
dsBaseCalc.Tables("BASE_CALC_CODES").PrimaryKey = ("GROUP_NAME")
dsBaseCalc.Tables("BASE_CALC_CODES").PrimaryKey = ("ENTITY_TYPE")
dsBaseCalc.Tables("BASE_CALC_CODES").PrimaryKey = ("DESCRIPTION")
any help would be greatly appreciated. I am a newbie
Erica
|
|
|
|
|
Never tried it, but I think you can just make an array of datacolumns to pass as the primarykey:
Dim pk3(2) As DataColumn
pk3(0) = MyDataTable.Columns("Col1")
pk3(1) = MyDataTable.Columns("Col2")
pk3(2) = MyDataTable.Columns("Col3")
MyDataTable.PrimaryKey = pk3
|
|
|
|
|
Thank you so much for that info.
Erica
|
|
|
|
|