Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
1.50/5 (4 votes)
See more:
hi, i got a probleam with my database, the probleam is i have 10 of empty row which doesnt not have any data, this is happen because i click to many insert button insert data. Please show me the coding should i use to delete my empty row. For you info i have table name is Bundle and 2 column which is name and type . Please give me example please.Is this my coding correct

VB
connection.ConnectionString = " Data Source=Danawa;Initial Catalog=Store;Integrated Security=True"
Try

connection.Open()
cmd = New SqlCommand("DELETE FROM bundle WHERE type = is NUll'" & Me.txtsearchbundle.Text & "' ", connection)
ra = cmd.ExecuteNonQuery()
MsgBox("Category Are Deleted!!", MsgBoxStyle.Information, "Record Deleted = " & ra)

Catch ex As Exception
MsgBox("Record Failed to Delete")
End Try
connection.Close()


[Edit]Added "code" tag - losmac[/Edit]
Posted
Updated 18-Oct-11 6:19am
v2

Use this query "DELETE FROM bundle WHERE type is Null or type = ''"
 
Share this answer
 
Once you get the empty rows deleted, fix your database so you cannot add NULL data to fields that don't logically support it and then fix your code so you're not inserting empty records.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900