joshi_nitin
Feb 10th, 2005, 01:57 AM
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!!!
mendhak
Feb 10th, 2005, 02:35 AM
Instantiate an object of that VB file's class, then the object will expose the function to you.
joshi_nitin
Feb 10th, 2005, 02:54 AM
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!!!
mendhak
Feb 10th, 2005, 03:04 AM
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:
objectname.insert(TextBox1.Text, textbox3.Text, TextBox7.Text)
mendhak
Feb 10th, 2005, 03:29 AM
Add [Resolved] To the thread title.