hi,
there, im coming up with codes to connect asp.net interface(Track) with asp.net interface(Clerk). i am not sure if my codes are correct. at the same time, i am not sure how to write codes to write the select statement which can connect asp.net interface with sql server. please help.
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" %>
<%@Import NameSpace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Configuration" %>
<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim MyConnection As SqlConnection
Dim MyCommand As SqlCommand
Dim MyReader As SqlDataReader
MyConnection = New SqlConnection()
MyConnection.ConnectionString = _
ConfigurationManager.ConnectionStrings("ConnectionString2").ConnectionString
Dim str As String = "insert into track(TrackingID,PickDATE,Consignment,Reference,Origin,Destination,Status,Destination,RecipientName) Values('" &TextBox1.Text& "','"&TextBox2&"','"&TextBox3.Text&"','" &TextBox4.Text& "','" &TextBox5.Text& "','" &TextBox6.Text& "','" &TextBox7.Text& "','" &TextBox8.Text& "');"
Dim Command As SqlCommand = "Select TrackingID.Track from Clerk where (TrackingID.Track=TrackID.Clerk) "
MyCommand = New SqlCommand
MyCommand.CommandText = "Select "
MyCommand.CommandText = MyCommand.CommandText + "'"
MyCommand.CommandText = MyCommand.CommandText + "'"
MyCommand.CommandText = MyCommand.CommandText
MyCommand.Connection = MyConnection
MyCommand.Connection.Open()
MyReader = MyCommand.ExecuteReader()
MyCommand.Dispose()
MyConnection.Dispose()
End Sub
</script>