.Net Connector version 5.0.3.0 - Not showing Tables in VS2005
Posted by: joe sambuco
Date: January 16, 2007 11:26PM

I am using the .Net Connector version 5.0.3.0 in VS2005 in ASP.NET 2.0 and want to perform an edit/update on a Grid Control. I have tried using code to perform this but can do everyting BUT. I have also tryied to use the VS Tools from MySQL to create a Datasource and use the vanilla VS2005 functionality for updating, but but cannot see the tables in the wizard of the datasource. I create a manual update statement with "?" as parameters, and no go.
Can someone tell me what I am missing?

Code Update
Protected Sub grdtest_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles grdtest.RowUpdating
' NewValues collection to an array.
Dim records(e.NewValues.Count - 1) As DictionaryEntry
e.NewValues.CopyTo(records, 0)

' Iterate through the array and HTML encode all user-provided values
' before updating the data source.
Dim entry As DictionaryEntry
For Each entry In records

e.NewValues(entry.Key) = Server.HtmlEncode(entry.Value.ToString())

Next

Dim row As GridViewRow = grdtest.Rows(grdtest.EditIndex)
Dim txtRow_id As TextBox = CType(row.FindControl("txtRow_id"), TextBox)

Dim txtfname As TextBox = CType(row.FindControl("txtfname"), TextBox)
Dim txtLName As TextBox = CType(row.FindControl("txtLName"), TextBox)
Dim txtmidinit As TextBox = CType(row.FindControl("txtmidinit"), TextBox)
Dim txtdsiid As TextBox = CType(row.FindControl("txtdsiid"), TextBox)
Dim txtProgram As TextBox = CType(row.FindControl("txtProgram"), TextBox)
Dim txtemail As TextBox = CType(row.FindControl("txtemail"), TextBox)
Dim txtPhnum As TextBox = CType(row.FindControl("txtPhnum"), TextBox)
Dim txtOraclenum As TextBox = CType(row.FindControl("txtOraclenum"), TextBox)


Label1.Text = txtfname.Text & txtLName.Text & txtmidinit.Text & txtdsiid.Text
Dim mySelectQuery As String = "UPDATE ewns.tbl_person SET first_name='" & txtfname.Text & "', last_name='" & txtLName.Text & "', middle_initial='" & txtmidinit.Text & "', dsi_id='" & txtdsiid.Text & "', program_of_study='" & txtProgram.Text & "', email='" & txtemail.Text & "', phone_num='" & txtPhnum.Text & "', oracle_num='" & txtOraclenum.Text & "' WHERE row_id='" & txtRow_id.Text & "'"
''Dim strDestination As String = CType(e.Rows.FindControl("txtField1"), TextBox).Text
Dim myCommand As New MySql.Data.MySqlClient.MySqlCommand(mySelectQuery, myConnection)
Try
myConnection.Open()
myCommand.Connection = myConnection
myCommand.ExecuteNonQuery()
Catch exc As MySql.Data.MySqlClient.MySqlException
Response.Write(exc)
Exit Sub


Finally
myConnection.Close()

Me.grdtest.DataBind()
End Try
grdtest.EditIndex = -1
BindData()


ASP page
<asp:GridView ID="grdtest" runat="server" AutoGenerateColumns="False" ShowFooter="True" DataKeyNames="row_id">
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:CommandField ShowEditButton="True" />
<asp:TemplateField HeaderText="row_id">
<EditItemTemplate>
<asp:TextBox ID="txtRow_id" runat="server" Text='<%# Bind("row_id") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblrowid" runat="server" Text='<%# Eval("row_id") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="first_name">
<EditItemTemplate>
<asp:TextBox ID="txtfname" runat="server" Text='<%# Bind("first_name") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblfirstname" runat="server" Text='<%# Eval("first_name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="last_name">
<EditItemTemplate>
<asp:TextBox ID="txtLName" runat="server" Text='<%# Bind("last_name") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lbllastname" runat="server" Text='<%# Eval("last_name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="middle_initial">
<EditItemTemplate>
<asp:TextBox ID="txtmidinit" runat="server" Text='<%# Bind("middle_initial") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblmidinit" runat="server" Text='<%# Eval("middle_initial") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="dsi_id">
<EditItemTemplate>
<asp:TextBox ID="txtdsiid" runat="server" Text='<%# Bind("dsi_id") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lbldsi" runat="server" Text='<%# Eval("dsi_id") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="program_of_study">
<EditItemTemplate>
&nbsp;<asp:TextBox ID="txtProgram" runat="server" Text='<%# Bind("program_of_study") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblprogram" runat="server" Text='<%# Eval("program_of_study") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="email">
<EditItemTemplate>
<asp:TextBox ID="txtemail" runat="server" Text='<%# Bind("email") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblemail" runat="server" Text='<%# Eval("email") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="phone_num">
<EditItemTemplate>
<asp:TextBox ID="txtPhnum" runat="server" Text='<%# Bind("phone_num") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblphnum" runat="server" Text='<%# Eval("phone_num") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="oracle_num">
<EditItemTemplate>
<asp:TextBox ID="txtOraclenum" runat="server" Text='<%# Bind("oracle_num") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lbloraclenum" runat="server" Text='<%# Eval("oracle_num") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
&nbsp;
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><br />
&nbsp;<br />
</div>
</form>
</body>
</html>



Edited 1 time(s). Last edit at 01/17/2007 12:42PM by joe sambuco.

Options: ReplyQuote


Subject
Written By
Posted
.Net Connector version 5.0.3.0 - Not showing Tables in VS2005
January 16, 2007 11:26PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.