|
-
Feb 10th, 2005, 02:57 AM
#1
Thread Starter
New Member
Resolved
ok....one more..
I've created a .vb file in that i have some functions..for database...
i need to call taht function from my aspx file's button (in this file i'm having a button.on that button's click event i want to call that .vb file function) how can i do this...
Thanx!!!
Last edited by joshi_nitin; Feb 10th, 2005 at 05:24 AM.
-
Feb 10th, 2005, 03:35 AM
#2
Re: Calling a .vb file function!!
Instantiate an object of that VB file's class, then the object will expose the function to you.
-
Feb 10th, 2005, 03:54 AM
#3
Thread Starter
New Member
Re: Calling a .vb file function!!
ok...That nice...!!!! but...i have take values from that aspx page..(from text box)..so how i call those text boxes in .vb file..i' just giving my ROUGH code here of .vb file...
--------------------------------------------------------------------------
Public Function insert()
Dim sqlConn As SqlConnection
Dim sqlCmd As SqlCommand
Dim sqlCmd2 As SqlCommand
sqlConn = New SqlConnection("data source=SHANTASOFTDC;persist security info=False;user id=root;")
sqlConn.Open()
sqlCmd = New SqlCommand("Insert User_login_info(username,password,user) values('" & tbox3 & "','" & tbox4 & "','User')", sqlConn)
sqlCmd2 = New SqlCommand("Insert User_detail_info(firstname,lastname,phone,street,city,state,zip,country,Othercont)values('" & tbox1 & "','" & tbox2 & "','" & tbox6 & "','" & tbox7 & "','" & tbox8 & "','" & tbox9 & "','" & tbox10 & "','" & tbox11 & "')", sqlConn)
sqlCmd.ExecuteNonQuery()
sqlCmd2.ExecuteNonQuery()
sqlConn.Close()
------------------------------------------------------
Thanx!!!
-
Feb 10th, 2005, 04:04 AM
#4
Re: Calling a .vb file function!!
You'll have to change it. Make the insert() function accept arguments. Make this whole thing a class.
From the ASP.NET page's codebehind, instantiate an object of that class, and then call it like:
Code:
objectname.insert(TextBox1.Text, textbox3.Text, TextBox7.Text)
-
Feb 10th, 2005, 04:25 AM
#5
Thread Starter
New Member
Re: Calling a .vb file function!!
Thanx!!!!!
 SAHI HAI BIDU!!!
-
Feb 10th, 2005, 04:29 AM
#6
Re: Calling a .vb file function!!
Add [Resolved] To the thread title.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|