|
Hello everyone,
Can i delete a file forcefully at the time when that file is in use by another process.
Thanks.
|
|
|
|
|
To remove a file that is in use by another process, you have to kill the process that has the file open.
Example:
Public Sub TermProc(byval procname as string)
Dim processes() As Process
Dim proc As Process
processes = Process.GetProcesses
For Each proc In processes
If proc.ProcessName.ToLower = procname Then
Try
proc.Kill()
Exit For
Catch ex As Exception
Debug.WriteLine(ex.Message)
End Try
End If
Next
End Sub
Then you could remove the file.
System.IO.File.Delete(path)
|
|
|
|
|
Is there any way to keep that process running and just break the access of that process with that file.
Because that process is of my application. I'm working on some project in which i have to create lot of temporary files and then i need to delete also. Sometimes in a very rare case my application process don't stop accessing some of the files so that i cannot delete those file unless i will close my application.
What do u suggest about it.
|
|
|
|
|
You do not need to figure out how to delete the file, instead you need to figure out what is wrong with your existing code. Because something is certainly wrong!
You are trying to use the wrong approach to fix what basically amounts to a bug.
If a file is open because the application needs it, and another function in the same application tries to delete that file, then obviously there is a bug in your temp file deletion operation.
If there is no bug in the file deletion algorithm, i.e. you know for sure that it never tries to delete files that are stil needed, then you have a file that is no longer needed but cannot be deleted because it is still open. In that case the bug is in your opening and closing of temp files.
Either way it is a bug, period.
Rather than trying to write additional code to force the delete of a file that is "in use" you need to carefully reveiw your existing code and determine what this set of conditions ever arises in the firtrst place.
Robert
|
|
|
|
|
No, you can't. If your process doesn't own the handle to the file, you can't get at it. This would be a security violation.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am receiving this error when i try to update the database. the grid works fine untill i try to update the values---
Here is the errr===================
Server Error in '/DataBaseUpdate' Application.
--------------------------------------------------------------------------------
Specified argument was out of the range of valid values. Parameter name: index
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index
Source Error:
Line 87: Dim RestrictTen As String = CType(e.Item.Cells(16).Controls(0), TextBox).Text
Line 88: Dim RestrictEleven As String = CType(e.Item.Cells(17).Controls(0), TextBox).Text
Line 89: Dim RestrictTwelve As String = CType(e.Item.Cells(18).Controls(0), TextBox).Text
Line 90: '
Line 91: 'Get the connection
Source File: c:\inetpub\wwwroot\DataBaseUpdate\UpdateProducts.aspx.vb Line: 89
Stack Trace:
=========Here is the update section of the code--------------------
'UpDate OnClick This Fires
'
Sub dgProducts_Update(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
'
'Read in the values of the updated row
'ID'S
Dim IDProductRestrictions As Integer = CType(e.Item.Cells(1).Controls(0), TextBox).Text
Dim IDProduct As Integer = CType(e.Item.Cells(2).Controls(0), TextBox).Text
'ID'S
Dim MaxiumWidth As String = CType(e.Item.Cells(3).Controls(0), TextBox).Text
Dim MaxiumLength As String = CType(e.Item.Cells(4).Controls(0), TextBox).Text
Dim MinimumWidthForLiftTilt As String = CType(e.Item.Cells(5).Controls(0), TextBox).Text
Dim InsideMount As String = CType(e.Item.Cells(6).Controls(0), TextBox).Text
Dim OutsideMount As String = CType(e.Item.Cells(7).Controls(0), TextBox).Text
Dim ControlTilt As String = CType(e.Item.Cells(8).Controls(0), TextBox).Text
Dim StackingFormulas As String = CType(e.Item.Cells(9).Controls(0), TextBox).Text
Dim RestrictFive As String = CType(e.Item.Cells(10).Controls(0), TextBox).Text
Dim RestrictiveSix As String = CType(e.Item.Cells(11).Controls(0), TextBox).Text
Dim RestrictSeven As String = CType(e.Item.Cells(12).Controls(0), TextBox).Text
Dim RestrictEight As String = CType(e.Item.Cells(14).Controls(0), TextBox).Text
Dim RestrictNine As String = CType(e.Item.Cells(15).Controls(0), TextBox).Text
Dim RestrictTen As String = CType(e.Item.Cells(16).Controls(0), TextBox).Text
Dim RestrictEleven As String = CType(e.Item.Cells(17).Controls(0), TextBox).Text
Dim RestrictTwelve As String = CType(e.Item.Cells(18).Controls(0), TextBox).Text
'
'Get the connection
'
Dim cnn As New SqlConnection(ConfigurationSettings.AppSettings("cnn"))
cnn.Open()
'
'Set the command
'
Dim myCommand As New SqlCommand("SprocInsertProductRestrictive", cnn)
myCommand.CommandType = CommandType.StoredProcedure
'
'Add Parameters to the SQL query
'
Dim paramIDProductRestrictions As SqlParameter = New SqlParameter("@IDProductRestrictions", SqlDbType.Int, 4)
paramIDProductRestrictions.Value = IDProductRestrictions
myCommand.Parameters.Add(paramIDProductRestrictions)
'
Dim paramIDProduct As SqlParameter = New SqlParameter("@IDProduct", SqlDbType.Int, 4)
paramIDProduct.Value = IDProduct
myCommand.Parameters.Add(paramIDProduct)
'
Dim paramMaxiumWidth As SqlParameter = New SqlParameter("@MaxiumWidth", SqlDbType.VarChar, 3800)
paramMaxiumWidth.Value = MaxiumWidth
myCommand.Parameters.Add(paramMaxiumWidth)
'
Dim paramMaxiumLength As SqlParameter = New SqlParameter("@MaxiumLength", SqlDbType.VarChar, 3800)
paramMaxiumLength.Value = MaxiumLength
myCommand.Parameters.Add(paramMaxiumLength)
'
Dim paramMinimumWidthForLiftTilt As SqlParameter = New SqlParameter("@MinimumWidthForLiftTilt", SqlDbType.VarChar, 3800)
paramMinimumWidthForLiftTilt.Value = MinimumWidthForLiftTilt
myCommand.Parameters.Add(paramMinimumWidthForLiftTilt)
'
Dim paramInsideMount As SqlParameter = New SqlParameter("@InsideMount", SqlDbType.VarChar, 3800)
paramInsideMount.Value = InsideMount
myCommand.Parameters.Add(paramInsideMount)
'
Dim paramOutsideMount As SqlParameter = New SqlParameter("@OutsideMount", SqlDbType.VarChar, 3800)
paramOutsideMount.Value = OutsideMount
myCommand.Parameters.Add(paramOutsideMount)
'
Dim paramControlTilt As SqlParameter = New SqlParameter("@ControlTilt", SqlDbType.VarChar, 3800)
paramControlTilt.Value = ControlTilt
myCommand.Parameters.Add(paramControlTilt)
'
Dim paramStackingFormulas As SqlParameter = New SqlParameter("@StackingFormulas", SqlDbType.VarChar, 3800)
paramStackingFormulas.Value = StackingFormulas
myCommand.Parameters.Add(paramStackingFormulas)
'
Dim paramRestrictFive As SqlParameter = New SqlParameter("@RestrictFive", SqlDbType.VarChar, 3800)
paramRestrictFive.Value = RestrictFive
myCommand.Parameters.Add(paramRestrictFive)
'
Dim paramRestrictSix As SqlParameter = New SqlParameter("@RestrictSix", SqlDbType.VarChar, 3800)
paramRestrictSix.Value = RestrictiveSix
myCommand.Parameters.Add(paramRestrictSix)
'
Dim paramRestrictSeven As SqlParameter = New SqlParameter("@RestrictSeven", SqlDbType.VarChar, 3800)
paramRestrictSeven.Value = RestrictSeven
myCommand.Parameters.Add(paramRestrictSeven)
'
Dim paramRestrictEight As SqlParameter = New SqlParameter("@RestrictEight", SqlDbType.VarChar, 3800)
paramRestrictEight.Value = RestrictEight
myCommand.Parameters.Add(paramRestrictEight)
'
Dim paramRestrictNine As SqlParameter = New SqlParameter("@RestrictNine", SqlDbType.VarChar, 3800)
paramRestrictNine.Value = RestrictNine
myCommand.Parameters.Add(paramRestrictNine)
'
Dim paramRestrictTen As SqlParameter = New SqlParameter("@RestrictTen", SqlDbType.VarChar, 3800)
paramRestrictTen.Value = RestrictTen
myCommand.Parameters.Add(paramRestrictTen)
'
Dim paramRestrictEleven As SqlParameter = New SqlParameter("@RestrictEleven", SqlDbType.VarChar, 3800)
paramRestrictEleven.Value = RestrictEleven
myCommand.Parameters.Add(paramRestrictEleven)
'
Dim paramRestrictTwelve As SqlParameter = New SqlParameter("@RestrictTwelve", SqlDbType.VarChar, 3800)
paramRestrictTwelve.Value = RestrictTwelve
myCommand.Parameters.Add(paramRestrictTwelve)
'
myCommand.ExecuteNonQuery() 'Execute the UPDATE query
'
cnn.Close()
'
'Finally, set the EditItemIndex to -1 and rebind the DataGrid
'
dgUpdateProductRestrictions.EditItemIndex = -1
BindData()
End Sub
End Class
============Thank you.....................
Erik...
|
|
|
|
|
I see a couple of things to check.
1) The error message indicates that an indexed value such as an array is out of bounds.
2) The e.grid.cells if I recall correctly starts indexes as 0. On your line:
Dim RestrictTwelve As String = CType(e.Item.Cells(18).Controls(0), TextBox).Text
May be throwing the error as this could be out of bounds of there are only 18 items in grid.
Hope this helps....
|
|
|
|
|
i have restructured my code starting the cell index at (1) because of the edit button in the first cell. Now i am receive this error message.
I am not sure if this will help you any but my grid is displaying double for some reason. I have not had trouble with populating datalist and grids untill now with the edit situation and i have been on thid for 2 days, Making me loco
any suggestions at all to what i am doing wrong here... I WILL POST MY CODE AGAIN
Server Error in '/DataBaseUpdate' Application.
--------------------------------------------------------------------------------
Specified argument was out of the range of valid values. Parameter name: index
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index
Source Error:
Line 72: 'ID'S
Line 73: Dim IDProductRestrictions As Integer = CType(e.Item.Cells(1).Controls(0), TextBox).Text
Line 74: Dim IDProduct As Integer = CType(e.Item.Cells(2).Controls(0), TextBox).Text
Line 75: 'ID'S
Line 76: Dim MaxiumWidth As String = CType(e.Item.Cells(3).Controls(0), TextBox).Text
====================Update============================================
Sub dgProducts_Update(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
'
'Read in the values of the updated row
'ID'S
Dim IDProductRestrictions As Integer = CType(e.Item.Cells(1).Controls(0), TextBox).Text
Dim IDProduct As Integer = CType(e.Item.Cells(2).Controls(0), TextBox).Text
'ID'S
Dim MaxiumWidth As String = CType(e.Item.Cells(3).Controls(0), TextBox).Text
Dim MaxiumLength As String = CType(e.Item.Cells(4).Controls(0), TextBox).Text
Dim MinimumWidthForLiftTilt As String = CType(e.Item.Cells(5).Controls(0), TextBox).Text
Dim InsideMount As String = CType(e.Item.Cells(6).Controls(0), TextBox).Text
Dim OutsideMount As String = CType(e.Item.Cells(7).Controls(0), TextBox).Text
Dim ControlTilt As String = CType(e.Item.Cells(8).Controls(0), TextBox).Text
Dim StackingFormulas As String = CType(e.Item.Cells(9).Controls(0), TextBox).Text
Dim RestrictFive As String = CType(e.Item.Cells(10).Controls(0), TextBox).Text
Dim RestrictSix As String = CType(e.Item.Cells(11).Controls(0), TextBox).Text
Dim RestrictSeven As String = CType(e.Item.Cells(12).Controls(0), TextBox).Text
Dim RestrictEight As String = CType(e.Item.Cells(13).Controls(0), TextBox).Text
Dim RestrictNine As String = CType(e.Item.Cells(14).Controls(0), TextBox).Text
Dim RestrictTen As String = CType(e.Item.Cells(15).Controls(0), TextBox).Text
Dim RestrictEleven As String = CType(e.Item.Cells(16).Controls(0), TextBox).Text
Dim RestrictTwelve As String = CType(e.Item.Cells(17).Controls(0), TextBox).Text
'
'Get the connection
'
Dim cnn As New SqlConnection(ConfigurationSettings.AppSettings("cnn"))
cnn.Open()
'
'Set the command
'
Dim myCommand As New SqlCommand("SprocInsertProductRestrictive", cnn)
myCommand.CommandType = CommandType.StoredProcedure
'
'Add Parameters to the SQL query
'
Dim paramIDProductRestrictions As SqlParameter = New SqlParameter("@IDProductRestrictions", SqlDbType.Int, 4)
paramIDProductRestrictions.Value = IDProductRestrictions
myCommand.Parameters.Add(paramIDProductRestrictions)
'
Dim paramIDProduct As SqlParameter = New SqlParameter("@IDProduct", SqlDbType.Int, 4)
paramIDProduct.Value = IDProduct
myCommand.Parameters.Add(paramIDProduct)
'
Dim paramMaxiumWidth As SqlParameter = New SqlParameter("@MaxiumWidth", SqlDbType.VarChar, 3800)
paramMaxiumWidth.Value = MaxiumWidth
myCommand.Parameters.Add(paramMaxiumWidth)
'
Dim paramMaxiumLength As SqlParameter = New SqlParameter("@MaxiumLength", SqlDbType.VarChar, 3800)
paramMaxiumLength.Value = MaxiumLength
myCommand.Parameters.Add(paramMaxiumLength)
'
Dim paramMinimumWidthForLiftTilt As SqlParameter = New SqlParameter("@MinimumWidthForLiftTilt", SqlDbType.VarChar, 3800)
paramMinimumWidthForLiftTilt.Value = MinimumWidthForLiftTilt
myCommand.Parameters.Add(paramMinimumWidthForLiftTilt)
'
Dim paramInsideMount As SqlParameter = New SqlParameter("@InsideMount", SqlDbType.VarChar, 3800)
paramInsideMount.Value = InsideMount
myCommand.Parameters.Add(paramInsideMount)
'
Dim paramOutsideMount As SqlParameter = New SqlParameter("@OutsideMount", SqlDbType.VarChar, 3800)
paramOutsideMount.Value = OutsideMount
myCommand.Parameters.Add(paramOutsideMount)
'
Dim paramControlTilt As SqlParameter = New SqlParameter("@ControlTilt", SqlDbType.VarChar, 3800)
paramControlTilt.Value = ControlTilt
myCommand.Parameters.Add(paramControlTilt)
'
Dim paramStackingFormulas As SqlParameter = New SqlParameter("@StackingFormulas", SqlDbType.VarChar, 3800)
paramStackingFormulas.Value = StackingFormulas
myCommand.Parameters.Add(paramStackingFormulas)
'
Dim paramRestrictFive As SqlParameter = New SqlParameter("@RestrictFive", SqlDbType.VarChar, 3800)
paramRestrictFive.Value = RestrictFive
myCommand.Parameters.Add(paramRestrictFive)
'
Dim paramRestrictSix As SqlParameter = New SqlParameter("@RestrictSix", SqlDbType.VarChar, 3800)
paramRestrictSix.Value = RestrictSix
myCommand.Parameters.Add(paramRestrictSix)
'
Dim paramRestrictSeven As SqlParameter = New SqlParameter("@RestrictSeven", SqlDbType.VarChar, 3800)
paramRestrictSeven.Value = RestrictSeven
myCommand.Parameters.Add(paramRestrictSeven)
'
Dim paramRestrictEight As SqlParameter = New SqlParameter("@RestrictEight", SqlDbType.VarChar, 3800)
paramRestrictEight.Value = RestrictEight
myCommand.Parameters.Add(paramRestrictEight)
'
Dim paramRestrictNine As SqlParameter = New SqlParameter("@RestrictNine", SqlDbType.VarChar, 3800)
paramRestrictNine.Value = RestrictNine
myCommand.Parameters.Add(paramRestrictNine)
'
Dim paramRestrictTen As SqlParameter = New SqlParameter("@RestrictTen", SqlDbType.VarChar, 3800)
paramRestrictTen.Value = RestrictTen
myCommand.Parameters.Add(paramRestrictTen)
'
Dim paramRestrictEleven As SqlParameter = New SqlParameter("@RestrictEleven", SqlDbType.VarChar, 3800)
paramRestrictEleven.Value = RestrictEleven
myCommand.Parameters.Add(paramRestrictEleven)
'
Dim paramRestrictTwelve As SqlParameter = New SqlParameter("@RestrictTwelve", SqlDbType.VarChar, 3800)
paramRestrictTwelve.Value = RestrictTwelve
myCommand.Parameters.Add(paramRestrictTwelve)
'
myCommand.ExecuteNonQuery() 'Execute the UPDATE query
'
cnn.Close()
'
'Finally, set the EditItemIndex to -1 and rebind the DataGrid
'
dgUpdateProductRestrictions.EditItemIndex = -1
BindData()
End Sub
End Class
=====================Grid----------------
<asp:datagrid id="dgUpdateProductRestrictions" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 8px"
="" runat="server" oneditcommand="dgProducts_Edit" oncancelcommand="dgProducts_Cancel" onupdatecommand="dgProducts_Update">
<footerstyle backcolor="Tan">
<selecteditemstyle forecolor="GhostWhite" backcolor="DarkSlateBlue">
<alternatingitemstyle backcolor="PaleGoldenrod">
<itemstyle wrap="False">
<headerstyle backcolor="#99CCCC">
<columns>
<asp:editcommandcolumn buttontype="PushButton" updatetext="Update" canceltext="Cancel" edittext="Edit Info">
<asp:boundcolumn datafield="ProductRestrictionsID" headertext="ProductRestrictionsID">
<asp:boundcolumn datafield="ProductID" readonly="True" headertext="ProductID">
<asp:boundcolumn datafield="MaximumWidth" headertext="MaxiumWidth">
<asp:boundcolumn datafield="MaximumLength" headertext="MaxiumLength">
<asp:boundcolumn datafield="MinimumWidthForLiftTilt" headertext="MinimumWidthForLiftTilt">
<asp:boundcolumn datafield="InsideMount" headertext="InsideMount">
<asp:boundcolumn datafield="OutsideMount" headertext="OutsideMount">
<asp:boundcolumn datafield="ControlTilt" headertext="ControlTilt">
<asp:boundcolumn datafield="StackingFormulas" headertext="StackingFormulas">
<asp:boundcolumn datafield="RestrictFive" headertext="RestrictFive">
<asp:boundcolumn datafield="RestrictSix" headertext="RestrictSix">
<asp:boundcolumn datafield="RestrictSeven" headertext="RestrictSeven">
<asp:boundcolumn datafield="RestrictEight" headertext="RestrictEight">
<asp:boundcolumn datafield="RestrictNine" headertext="RestrictNine">
<asp:boundcolumn datafield="RestrictTen" headertext="RestrictTen">
<asp:boundcolumn datafield="RestrictEleven" headertext="RestrictEleven">
<asp:boundcolumn datafield="RestrictTwelve" headertext="RestrictTwelve">
|
|
|
|
|
Ok i finally got everything to work with no errors, only now when i fill in the new data and Press UPDATE the database does not update.
Anyone can help me one this one?
Thanks in advance...
ERIK....
Here is my code============
Public Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
BindData()
End If
End Sub
Sub BindData()
'
'1. Create a connection
Dim cnn As New SqlConnection(ConfigurationSettings.AppSettings("cnn"))
cnn.Open()
'You must open the db connection before populating the DataReader
'
'2. Create a command object for the query
Dim myBindingCommand As New SqlCommand("SELECT * FROM ProductRestrictions", cnn)
'
'3. Create/Populate the DataReader
Dim result As SqlDataReader = myBindingCommand.ExecuteReader(CommandBehavior.CloseConnection)
'
dgUpdateProductRestrictions.DataSource = result
dgUpdateProductRestrictions.DataBind()
End Sub
'
'Makes controls appear (Like the text box controls) when clicked
'
Sub dgProducts_Edit(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
dgUpdateProductRestrictions.EditItemIndex = e.Item.ItemIndex
BindData()
End Sub
'
'Cancel when button is fired
'
Sub dgProducts_Cancel(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
dgUpdateProductRestrictions.EditItemIndex = -1
BindData()
End Sub
'
'UpDate OnClick This Fires
'
Sub dgProducts_Update(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
'
'Read in the values of the updated row
'ID'S
Dim IDProduct As Integer = e.Item.Cells(1).Text
'ID'S
Dim MaximumWidth As String = CType(e.Item.Cells(2).Controls(0), TextBox).Text
Dim MaximumLength As String = CType(e.Item.Cells(3).Controls(0), TextBox).Text
Dim MinimumWidthForLiftTilt As String = CType(e.Item.Cells(4).Controls(0), TextBox).Text
Dim InsideMount As String = CType(e.Item.Cells(5).Controls(0), TextBox).Text
Dim OutsideMount As String = CType(e.Item.Cells(6).Controls(0), TextBox).Text
Dim ControlTilt As String = CType(e.Item.Cells(7).Controls(0), TextBox).Text
Dim StackingFormulas As String = CType(e.Item.Cells(8).Controls(0), TextBox).Text
Dim RestrictFive As String = CType(e.Item.Cells(9).Controls(0), TextBox).Text
Dim RestrictSix As String = CType(e.Item.Cells(10).Controls(0), TextBox).Text
Dim RestrictSeven As String = CType(e.Item.Cells(11).Controls(0), TextBox).Text
Dim RestrictEight As String = CType(e.Item.Cells(12).Controls(0), TextBox).Text
Dim RestrictNine As String = CType(e.Item.Cells(13).Controls(0), TextBox).Text
Dim RestrictTen As String = CType(e.Item.Cells(14).Controls(0), TextBox).Text
Dim RestrictEleven As String = CType(e.Item.Cells(15).Controls(0), TextBox).Text
Dim RestrictTwelve As String = CType(e.Item.Cells(16).Controls(0), TextBox).Text
'
'Get the connection
'
Dim cnn As New SqlConnection(ConfigurationSettings.AppSettings("cnn"))
cnn.Open()
'
'Set the command
'
Dim myCommand As New SqlCommand("SprocInsertProductRestrictive", cnn)
myCommand.CommandType = CommandType.StoredProcedure
'
'Add Parameters to the SQL query
'
Dim paramIDProduct As SqlParameter = New SqlParameter("@IDProduct", SqlDbType.Int, 4)
paramIDProduct.Value = IDProduct
myCommand.Parameters.Add(paramIDProduct)
'
Dim paramMaximumWidth As SqlParameter = New SqlParameter("@MaximumWidth", SqlDbType.VarChar, 3800)
paramMaximumWidth.Value = MaximumWidth
myCommand.Parameters.Add(paramMaximumWidth)
'
Dim paramMaximumLength As SqlParameter = New SqlParameter("@MaximumLength", SqlDbType.VarChar, 3800)
paramMaximumLength.Value = MaximumLength
myCommand.Parameters.Add(paramMaximumLength)
'
Dim paramMinimumWidthForLiftTilt As SqlParameter = New SqlParameter("@MinimumWidthForLiftTilt", SqlDbType.VarChar, 3800)
paramMinimumWidthForLiftTilt.Value = MinimumWidthForLiftTilt
myCommand.Parameters.Add(paramMinimumWidthForLiftTilt)
'
Dim paramInsideMount As SqlParameter = New SqlParameter("@InsideMount", SqlDbType.VarChar, 3800)
paramInsideMount.Value = InsideMount
myCommand.Parameters.Add(paramInsideMount)
'
Dim paramOutsideMount As SqlParameter = New SqlParameter("@OutsideMount", SqlDbType.VarChar, 3800)
paramOutsideMount.Value = OutsideMount
myCommand.Parameters.Add(paramOutsideMount)
'
Dim paramControlTilt As SqlParameter = New SqlParameter("@ControlTilt", SqlDbType.VarChar, 3800)
paramControlTilt.Value = ControlTilt
myCommand.Parameters.Add(paramControlTilt)
'
Dim paramStackingFormulas As SqlParameter = New SqlParameter("@StackingFormulas", SqlDbType.VarChar, 3800)
paramStackingFormulas.Value = StackingFormulas
myCommand.Parameters.Add(paramStackingFormulas)
'
Dim paramRestrictFive As SqlParameter = New SqlParameter("@RestrictFive", SqlDbType.VarChar, 3800)
paramRestrictFive.Value = RestrictFive
myCommand.Parameters.Add(paramRestrictFive)
'
Dim paramRestrictSix As SqlParameter = New SqlParameter("@RestrictSix", SqlDbType.VarChar, 3800)
paramRestrictSix.Value = RestrictSix
myCommand.Parameters.Add(paramRestrictSix)
'
Dim paramRestrictSeven As SqlParameter = New SqlParameter("@RestrictSeven", SqlDbType.VarChar, 3800)
paramRestrictSeven.Value = RestrictSeven
myCommand.Parameters.Add(paramRestrictSeven)
'
Dim paramRestrictEight As SqlParameter = New SqlParameter("@RestrictEight", SqlDbType.VarChar, 3800)
paramRestrictEight.Value = RestrictEight
myCommand.Parameters.Add(paramRestrictEight)
'
Dim paramRestrictNine As SqlParameter = New SqlParameter("@RestrictNine", SqlDbType.VarChar, 3800)
paramRestrictNine.Value = RestrictNine
myCommand.Parameters.Add(paramRestrictNine)
'
Dim paramRestrictTen As SqlParameter = New SqlParameter("@RestrictTen", SqlDbType.VarChar, 3800)
paramRestrictTen.Value = RestrictTen
myCommand.Parameters.Add(paramRestrictTen)
'
Dim paramRestrictEleven As SqlParameter = New SqlParameter("@RestrictEleven", SqlDbType.VarChar, 3800)
paramRestrictEleven.Value = RestrictEleven
myCommand.Parameters.Add(paramRestrictEleven)
'
Dim paramRestrictTwelve As SqlParameter = New SqlParameter("@RestrictTwelve", SqlDbType.VarChar, 3800)
paramRestrictTwelve.Value = RestrictTwelve
myCommand.Parameters.Add(paramRestrictTwelve)
'
myCommand.ExecuteNonQuery() 'Execute the UPDATE query
'
cnn.Close()
'
'Finally, set the EditItemIndex to -1 and rebind the DataGrid
'
dgUpdateProductRestrictions.EditItemIndex = -1
BindData()
End Sub
|
|
|
|
|
Hi guys,
I want to know how to make a chatting program like yahoo and msn messenger that you can install it on the computer and connect it with the server through the internet that using sql server 2000 database ?
thanks
|
|
|
|
|
|
Hi
i repeat here cause i didn't get answer about how ?
and i get about "Search"
i want explanation about that
thanks
|
|
|
|
|
You didn't get the answer that you wanted. I suggest you start searching and reading because the answers that you want are WAY TOO LARGE to post in any forum. Next time, try asking a more specific question about what you don't understand. Don't ask a qeustion about getting a documentry made about the in's and out's of what you want to write.
The ability to do research, on your own, and learn the skills you need on-the-fly is the PRIMARY skill you need to survive in this business.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanks again for your response but i have a few comment about what you wrote,
1-If about searching the web i can search the web its not a problem, but here i didnt search instead of that i put my question here and there is alot of programmer here and maybe i can find a solution for my question.
2-If my question is very wide you can put a points that facilitate the things that are wide and to clarify for the questioner the points that he must take into consideration.
Thanks alot again for your response
with best wishes
|
|
|
|
|
smart_sdr wrote:
If my question is very wide you can put a points that facilitate the things that are wide and to clarify for the questioner the points that he must take into consideration.
What do you think I did in response to your first post?!?!?!?!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
oooohhhh don't be upset my fellow i didn't want to upset you but understand this, i will give an example for this :
if someone said that he want to make database system and he want to use this with the vb.net and he asked about how to do it ?
this is also a wide question cause what type of a database he want to use and about what he want to make his database system through the internet or just by using a local area network ?
and you can give this answer :
my friend i saw your question but if you want to make a database system you must take this into consideration :
1- you can use access database or sql server 2000 or oracle .
2- you can make your system working through the internet and you must use asp.net or if you like php with mySQL .
3- you can make your system work only on the lan (local area network) and in this situation you need vb.net and one of the database that i mentioned it into the point 1.
4- and for now i will give some info about using vb.net with sql :
4a- you must know the vb.net syntax and object oriented programming and about to connect with the database.
for example i mention you this book "Visual Basic.Net programming with Peter Aitken" at http://bookpool.com/sm/1932111166
4b- you must know about the sql server and for the beginning i mention you this book "Wrox - Visual Studio .NET - Beginning Visual Basic .NET Database Programming"
at http://support.apress.com/books.asp?bID=1861005555&s=0&Go=Select+Book
and in this book they will use sql server 2000 Desktop that you can download it from the internet from the microsoft site.
this is just afew info to give a start point for what you want.
thanks.
----------------------------------
this is an example, Dave let us to see what you wrote to me :
"Well, knowledge of TCP/IP would help alot. How to write clients that communicate using sockets, and most of all how to write a multi-threaded socket server. Just search the articles for "CHAT" and you'll come up with a bunch of examples.
I fail to see how an SQL Server figures into this, unless you're going to be logging everything everyone says."
1-"Well, knowledge of TCP/IP would help alot"
*this is a wide info, what you mean with this about studying the networking (network programming or just networking theories ) ?
2-"How to write clients that communicate using sockets"
*without specification about how to make it or if there's a book that talking about that ?
3-"and most of all how to write a multi-threaded socket server"
*also like the point 2
4-"Just search the articles for "CHAT" and you'll come up with a bunch of examples."
*i wrote the "CHAT" in the google and i got 98,600,000 pages !!!
and i wrote it in the yahoo and i got 438,000,000 !!!
5-"I fail to see how an SQL Server figures into this, unless you're going to be logging everything everyone says."
*this is your sight about this.
Dave don't be upset and thanks again for your response i want you for me to be my friend.
im a programmer also since 1995 and i used the assembly programming on motorola processors like amiga 500 and amiga 1200 and also with the processor 68030 accelerator and i was a cracker on the amiga computer. and then i moved to the pc and i studied the reverse engineering and i became a cracker on the pc also but now i left this side and i made a cd copy protection program by using VC++,and about the structure of the pe (exe file portable executable) and also about the data structure of the cd image file format and also about what i knew from the cracking part and also about aspi (advanced scsi II programming interface).
then i tried to make a 3d game and i studied the VC++ (api mode) Application Programming Interface and Direct X 7 and then i moved to the DirectX 9 but i left it also cause i was alone (programmer) and my brother knows about 3d studio max but also its hard to make a 3d game without a team cause there is a lot of studying that i must make about
physics for games and mathematics for games and AI (Artificial Intelligent) and also about alot of stuff.
and then im using the vb.net and sql server to make a business
and i learned about the sql server since afew months.
again nice to meet you
and im sorry if i made you upset
with best wishes
smart_sdr
|
|
|
|
|
Ok, here we go...
smart_sdr wrote:
1-"Well, knowledge of TCP/IP would help alot"
*this is a wide info, what you mean with this about studying the networking (network programming or just networking theories ) ?
Yes, TCP/IP theory covers entire books. Amazon.com is a good place to start. Without this knowledge, you can't even begin to understand the programming required to make your application work. Especially when dealing with firewalls and NAT's.
smart_sdr wrote:
2-"How to write clients that communicate using sockets"
*without specification about how to make it or if there's a book that talking about that ?
Again, an entire book. I defer to Amazon and your ability to evaluate your own experience and skills to pick an appropriate book for yourself.
smart_sdr wrote:
3-"and most of all how to write a multi-threaded socket server"
*also like the point 2
Same book as 2...
smart_sdr wrote:
4-"Just search the articles for "CHAT" and you'll come up with a bunch of examples."
*i wrote the "CHAT" in the google and i got 98,600,000 pages !!!
and i wrote it in the yahoo and i got 438,000,000 !!!
I said search the ARTICLES, not Google. Let me make it easy for you, click here[^].
smart_sdr wrote:
5-"I fail to see how an SQL Server figures into this, unless you're going to be logging everything everyone says."
*this is your sight about this.
I still have no idea how you're going to use an SQL server in a Chat application. You never said what you wanted to do with it in relation to chat.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks again my friend for your response
about the sql server i want to save all the info about the chatters and who is online and offline and etc... .
i saw this book on the net and i want to take your opinion about it
"Network Programming in .NET" at
http://www.webtropy.com/
thanks again
with best wishes
smart_sdr
|
|
|
|
|
Awsome book. I have it myself.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i'm reading it now it's very interesting book, i like it.
dave if you have a an yahoo id and wanna chat with me so this is my yahoo id and also my msn id :
smart_sdr78@yahoo.com
smart_sdr@hotmail.com
with best wishes
smart_sdr
|
|
|
|
|
Guys,
I need to export an access database table to a txt file within the code
how can i do that? please any help
|
|
|
|
|
Somthing like this:
Private Sub MSAccessToTextFile()
Dim dbConn As OleDbConnection
Dim dbCommand As OleDbCommand
Dim dbReader As OleDbDataReader
Dim swFile As StreamWriter = File.CreateText(Application.StartupPath & "\myfile.txt")
Dim ConnectString As String = "Provider=Microsoft.Jet.OleDB.4.0; data source=" & Application.StartupPath & "\Books.mdb"
Try
dbConn = New OleDbConnection(connectString)
dbConn.Open()
Dim lcSQL As String = "select * from Books"
dbCommand = New OleDbCommand(lcSQL, dbConn)
dbReader = dbCommand.ExecuteReader
Do While dbReader.Read
swFile.WriteLine(dbReader.GetValue(0).ToString() & "," & dbReader.GetValue(1).ToString())
Loop
swFile.Flush()
swFile.Close()
If Not dbReader.IsClosed Then
dbReader.Close()
End If
If Not dbConn.State = ConnectionState.Closed Then
dbConn.Close()
End If
dbCommand.Dispose()
dbReader = Nothing
dbCommand = Nothing
dbConn = Nothing
Catch oErr As Exception
MessageBox.Show(oErr.ToString())
End Try
End Sub
|
|
|
|
|
Thanks for your response
but isn't there a way to export all fields without having to pass the index for each one using GetValue(i) ..?
Sorry if my Q seems silly, but i'm wondering if it could be done in a more general way so it can be used to export different tables with different fields
Thanks
|
|
|
|
|
hi guys,
I met this problem with VB.Net 2003 :
Dim st1 As String
Dim blnResult As Boolean
st1 = "Hello World"
blnResult = st1.StartsWith("lo") 'it must return true but it returned false !!!!!!
is there any info about that ??
thanks
|
|
|
|
|
StartsWith determines whether the beginning of the string matches the specified string
"lo" is not the start
For your case you might wanna use IndexOf
|
|
|
|
|