how to run a sql server 2005 sp through a windows application programm designed with vb.net 2005
how to run a sql server 2005 sp through a windows application programm designed with vb.net 2005
What do you mena by to run a sql server 2005 sp through a windows application programm ?
are you trying to execute DML /DDL statments or something else ?
cmd = New SqlCommand("storedprocedure name", constr)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@variable name", SqlDbType.datatype, value).Value = selectedcontrol.SelectedItem.Value
cmd.Parameters.Add("@variable name", SqlDbType.datatype, value).Value = ddCommodity.SelectedItem.Value
constr.Open()
varable name = cmd.ExecuteReader()
u can connect vb.net2005 with sql server 2005 very easily, simply write 3 lines in the code
At the top of coding page write "Imports system.data.sqlclient", then there will be 1 line after that which will come automatically showing that webform after that write "Proteced sub as sqlconnection".............After that in the connection string every time write "Data Source=ASHISH\SQLEXPRESS;Initial Catalog=museum;Integrated Security=True"...................At the place of "ASHISH" write your computers name, at the place of "museum" write your database name from which u want to connect...
Last edited by ashish rai; 08-11-2008 at 11:51 AM.
connetionString = "Data Source=ServerName;Initial Catalog=DatabaseName;User ID=UserName;Password=Password"
cnn = New SqlConnection(connetionString)
Try
cnn.Open()
MsgBox("Connection Open ! ")
cnn.Close()
Catch ex As Exception
MsgBox("Can not open connection ! ")
End Try
for details information
ADO.NET SQL Server Connection
chan.
If ur trying to connect any .net application with sqlserver ,then u need to create a connetion sting and sql commend like DML ans DDL