Notifications
Clear all

[Closed] How to write maxscript for connection sqlserver 2005

How to write maxscript for connection sqlserver 2005!!

Thanks a lot!!

1 Reply

Hi, I have here this snippet that was kind of lost but maybe this can help you starting up! hope this helps. Cya.


(
dotnet.loadassembly "System.Data"
 
lst_test=dotnetObject "System.Windows.Forms.Listbox"
 
constring = "data source=BACKUPS\SQLEXPRESS;Initial Catalog=IPM_0_2_0_0;Integrated Security=True;Connect Timeout=30"
con = dotNetObject "System.Data.SqlClient.SqlConnection" constring
 
dataset = dotNetObject "System.Data.Dataset"
tableadapter = dotNetObject "System.Data.SqlClient.SqlDataAdapter" "SELECT * FROM users" constring
tableadapter.fill dataset "users"
 
lst_test.DataSource=dataset.tables.item["users"]
lst_test.DisplayMember = "username"
 
 
hForm = dotNetObject "System.Windows.Forms.Form"
hForm.Size = dotNetObject "System.Drawing.Size" 310 335
hForm.Text = ".Net 2.0 Form with TextBox"
hForm.Controls.Add(lst_test)
hForm.TopMost = true
FormBorderStyle = dotNetClass "System.Windows.Forms.FormBorderStyle"
hForm.FormBorderStyle = FormBorderStyle.FixedDialog
hForm.ShowInTaskbar = false
hForm.MinimizeBox = false
hForm.MaximizeBox = false
 
hApp = dotNetClass "System.Windows.Forms.Application"
hApp.Run hForm
 
on lst_test Selected
)