|
How about creating an array of ShipmentItems?
Dim shipItems() As ShipmentItems
Shipment.ShipmentItems = shipItems
|
|
|
|
|
Thank you.
This is fixed.
|
|
|
|
|
Hi
I have writing the followin function which catches a datagrid link button event, which should take the user id from the selected record and pass it into a stored procedure, and then refresh page, with the selected record deleted.
It all seems to work perfectly fine, but it jus doesn't delete for the some reason
I have also ran the procedure through a command window and that works as expected
here is my code for dealing with the button click and passing the parameter into the stored procedure
any help or spotting of my retarded mistake would be much appreciated
cheers
boyindie
Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As DataGridItemEventArgs) Handles dgPriv.ItemDataBound
Dim l As LinkButton
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
l = CType(e.Item.Cells(6).FindControl("cmdDel"), LinkButton)
l.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');")
End If
End Sub
Sub dgpriv_ItemCommand(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) Handles dgPriv.ItemCommand
Dim iid As Integer = dgPriv.DataKeys(e.Item.ItemIndex) 'Grab the ID from the hidden column
Dim litErr As New Literal
Dim myConnection As New MySqlConnection("Server=localhost; ;database=test;")
Try
Dim param As New MySqlParameter
Dim myDeleteCommand As MySqlCommand = New MySqlCommand("sp_mydelete", myConnection)
myDeleteCommand.CommandType = CommandType.StoredProcedure
param = myDeleteCommand.Parameters.Add("?p_id", MySqlDbType.VarChar)
param.Direction = ParameterDirection.Input
param.Value = iid
myConnection.Open() 'Open the connection
myDeleteCommand.ExecuteNonQuery() 'Delete the record
myConnection.Close() 'Close the connection
Catch ex As Exception
litErr.Text = ex.Message
MsgBox(ex.Message)
End Try
refresh()
End Sub
and this is my asp code
<asp:datagrid id="dgPriv" runat="server" BorderWidth="0"
CellPadding="4" Width="100%"
Font-Size="Smaller"
HeaderStyle-HorizontalAlign="Center"
HeaderStyle-Font-Bold="True"
datakeyfield ="userId"
HeaderStyle-BackColor="Navy"
HeaderStyle-ForeColor="White"
AlternatingItemStyle-BackColor="ActiveBorder" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn DataField ="userId" HeaderText="User ID"></asp:BoundColumn>
<asp:BoundColumn DataField ="username" HeaderText="User Name"></asp:BoundColumn>
<asp:BoundColumn DataField ="user_firstName" HeaderText="First Name"></asp:BoundColumn>
<asp:BoundColumn DataField ="user_lastname" HeaderText="Last Name"></asp:BoundColumn>
<asp:BoundColumn DataField ="groups" HeaderText="Privelages"></asp:BoundColumn>
<asp:BoundColumn DataField ="joinDate" HeaderText="Date Registered"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Delete User">
<ItemTemplate >
<asp:linkbutton id="cmdDel" runat="server">Delete</asp:linkbutton>
</ItemTemplate></asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign="Left" />
<AlternatingItemStyle BackColor="ActiveBorder" />
<HeaderStyle BackColor="Navy" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" />
</asp:datagrid>
</div>
</form>
|
|
|
|
|
Your current code seems to be right, the only reason I can think of is you have done some silly mistake in your stored procedure. Did you debug the code? Does it get the iid value you want to delete?
If it gets through your myDeleteCommand.ExecuteNonQuery() line without any exception, it bound to be the stored procedure.
|
|
|
|
|
ah the joys of copy and pastin previous code and forgettin to change the database name to the one you want to use!
It was working fine it was jus using the procedure of the same name in the wrong database!
cheers for your help
|
|
|
|
|
I don't suppose you know how to bind data to a textbox
I have been trying to find a way of taking a value from a select statement and binding it to a textbox, should be so easy but can't find a method to do it!
|
|
|
|
|
My program needs to access and manipulate a table created by a third party vender. We want to catch when the table or tables are updated. When i set up the connection and set up the Adapter, I get a error when I try to access the tables saying that I don't have permissions. but some tables I can access. What do you suggest I do? Is there a query in Access I can do that updates every time a table or tables change? then I could access that query or have that query write to table that I can access. Keep in mind that I want to update the original table that I don't have access to.
Any ideas?
|
|
|
|
|
Cory Kimble wrote: Is there a query in Access I can do that updates every time a table or tables change?
No. Access databases do not support triggers. There's no way to capture when the database is updated from any and all sources.
The only way this can happen using Access is if all database transactions are done through a component that you write to do all the database work. All other applications that use that database MUST also go through your component.
Cory Kimble wrote: Keep in mind that I want to update the original table that I don't have access to.
Then you're not going to access what you don't have permissions to. If you don't have to permissions, you're not going to get them unless they are granted to you by the admin of the database. No permissions equals no update.
In your situation, you simply have no options.
|
|
|
|
|
Does the third party software keep a log of table changes? If so you could import that into your db.
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
No log. But, It has a query in the database that updates automatically. Is there a way I can use that?
|
|
|
|
|
Cory Kimble wrote: It has a query in the database that updates automatically
There is nothing in Access that updates THAT automatically. You'll have to find out what's making this change. That's IF you have to rights to poke around the database that much.
|
|
|
|
|
Hi,
Why is it not possible to make the value variable of a property setter ByRef? actually i need to access multiple properties of a calling form in the class and was therefore trying to pass the reference to the form to the class. Is there any way around this?
Thanks in advance!
Ahmad
|
|
|
|
|
You can't change the Setter to ByRef. It also doesn't need it. A property setter is expected to NOT change the object being passed to it, so why would you need a Ref to it??
Ahmad Zaidi wrote: i need to access multiple properties of a calling form in the class
??? Post a copy of the property code so we can see what you're trying to do. It sounds like you;re trying to exceed the bounds of what a property should be doing.
|
|
|
|
|
You are confusing a reference with passing parameters by reference. You don't need to pass a parameter by reference to pass a reference as a parameter.
You only pass parameters by reference when you need to change the variable that you are passing as a parameter. The default way of passing parameters is by value. For a reference type it means that the value of the referece is passed, i.e. a copy of the reference.
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks alot guys. You're right, i've done it with a function instead!
|
|
|
|
|
I want to write a windows service application that reads a web page. That web page requires that the client can process javascript.
Has anyone successfully implemented Javascript with System.Net.WebClient?
I tried the code from the article "A simple .NET based WebClient with JavaScript support" but that code crashes with an inner JScriptException. Its acknowledged by the author and it looks like the trail ends there.
According to microsoft the Microsoft.JScript.Vsa.VsaEngine used in that project is deprecated.
What is the current working solution for processing webpages in code?
This is what my code looks like. The web page at the URL I am calling uses javascript to set a cookie in order to prove that Javascript is running. It doesn't look like this code can do it. I can set cookies in advance but I can't seem to duplicate the javascipt setting a cookie. Help!
Dim webClient As Net.WebClient = New System.Net.WebClient
webClient.Credentials = System.Net.CredentialCache.DefaultCredentials
webClient.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
webClient.Headers.Add(Net.HttpRequestHeader.Cookie, "aCookie:aCokievalue")
Try
Dim data As Stream = webClient.OpenRead(sURL)
Dim reader As New StreamReader(data)
Dim s As String = reader.ReadToEnd()
'response = webClient.DownloadData(sURL)
'Return Encoding.ASCII.GetString(response)
Return s
Catch ex As Exception
Return ""
End Try
|
|
|
|
|
how do you put data into a database from a form?
|
|
|
|
|
1. Connect to database.
2. Create query from the data in the form.
3. Run the query against the database.
4. Disconnect from database.
|
|
|
|
|
how do you create the query ?
|
|
|
|
|
If you don't know SQL, you're going to find this pretty hard to do. Even if you don't want to learn SQL, learn it You ARE going to need it sometime in the future.
The query string is specific to your database table. It usually follow the following format:
SELECT columnName, columnName, columnName FROM tableName
WHERE someCondition
|
|
|
|
|
I have mistakenly deleted the my service exe from the specified path and it can't be obtained again but my control panel is still showing the service icon in my control panel > services. When i try to install the same service again from the installer,it says service already installed. Now how do i remove such a service from my control panel without my service exe?
@!$(-)@ $@r£r@Z
|
|
|
|
|
Uhhh, what does this have to do with VB.NET???
|
|
|
|
|
Hello.
I 'm writing my question for the third time, because I don't get a suitable answer. There is the origin of the Coordinate System on the top left corner of forms in VB.Net project. Is there a method or a code that we use it to change the condition of the origin of the Coordinate System. For example, set the origin of the Coordinate System on centere of the form? can you help me? please send me the method.
Thank you.
Reza Rajabi.
|
|
|
|
|
You could manually transform the co-ordinates. You'd just need to write a method that would add or remove the appropriate number of pixels. When setting the coordinates on a control or window you'd use the method to convert from yours to the windows standard.
As for the code, why not write it yourself? It's not that hard, just some simple maths (addition and subtraction).
|
|
|
|
|
Posting the question a 3rd time won't change the answers. You can change the origin by using the Scale and Transform methods and properties of the Graphics object your using to do the drawing.
|
|
|
|