problem wif inserting information into database

SqlDataSource1.SelectParameters("Hotel").DefaultValue = TextBox1.Text

GridView1.DataBind()

SqlDataSource1.Insert()

what i wanna do is to insert information to my database

the user can type the hotelname in the textbox1 and when the user press the ok button the hotelname that the user type in should appear in my database

i wrote the fllowing codes and but got the error sayin "Object reference not set to an instance of an object"

wats tat ?

[590 byte] By [wiscon] at [2007-12-23]
# 1

I would take time to look at the way data binding works and run through an example.

Free E-book - Chapter 4 shows a nice databinding walkthrough.

http://msdn.microsoft.com/vbasic/learning/introtovb2005/

Or you can write a SQL Command that will execute on the button click

SQL.data.SQLClient.Command
http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.aspx

You can do a SQL Insert instead of a Select but basically do a simple SQL Insert statement.

spotty at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic Language...